Skip to content

Instantly share code, notes, and snippets.

@benjaminW78
Created September 10, 2015 14:54
Show Gist options
  • Save benjaminW78/c3307972cd6aca7a1154 to your computer and use it in GitHub Desktop.
Save benjaminW78/c3307972cd6aca7a1154 to your computer and use it in GitHub Desktop.
.directive('myDirective', [function () {
return {
restrict : 'E',
replace : true,
controller: 'MyController',
templateUrl : 'directives/myDirective.tpl.html',
link : function (scope, elem, attrs, controller) {
scope.message = 'Hello World!';
controller.toto();
}
};
}])
.controller('MyController', [function ($scope, $element, $attrs, $log, $timeout) {
$scope.toto = function(){
console.log(lololool);
}
});
}])
@dhoko
Copy link

dhoko commented Sep 10, 2015

.directive('myDirective', [function () {
    return {
        restrict : 'E',
        replace : true,
        controller: 'MyController',
        controllerAs: 'vm'
        templateUrl : 'directives/myDirective.tpl.html',
        link : function (scope, elem, attrs, controller) {

            controller.toto();
        }
    };
}])

.controller('MyController', [function ($scope, $element, $attrs, $log, $timeout) {


        this.message = 'Hello world';

    });
}])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment