Closed developcreativo closed 7 years ago
class LikeifController { constructor(LikesService) { 'ngInject'; this.LikesService = LikesService; } isLike(stream_id, streams){ this.LikesService.getLikes(stream_id).then((response) => { if (response.data.message == "Unliked") { var elmn = angular.element(document.querySelector('#myDiv')); elmn.empty(); response.data.$destroy(); }else { streams.likes.data.push(response.data); } }); } } export function LikeifDirective() { return { controller: LikeifController, link: function(scope, element, attrs, controllers) { var cloneElement = null; var cloneScope = null; scope.$watch( attributes.bnGoodIf, function handleWatchChange(newValue, oldValue) { if (cloneElement) { cloneScope.$destroy(); cloneScope = null; cloneElement.remove(); cloneElement = null; } if (newValue) { cloneScope = scope.$new(); cloneElement = transclude( cloneScope, function injectClonedElement(clone) { element.after(clone); } ); } } ); } } }
mi controller import { LikeifDirective } from '../../../directives/likeif/likeif.directive.js'; $onInit(){
this.pagination = ''; this.loading = false; this.comentario = ""; //Functions likes this.likes = (stream_id, streams) => { LikeifController.isLike(); // ? }); } }
Hi @vdjkelly What's the error that you're getting?
Feel free to re-open with more info!
mi controller import { LikeifDirective } from '../../../directives/likeif/likeif.directive.js'; $onInit(){