Angular Test
by Juan Kristoffer Sanio
HTML
<div ng-app="myApp" ng-init="myObj = {text:'hello'}">
<my-directive message="world" obj="myObj"></my-directive>
</div>
JavaScript
(function() {
app = angular.module('myApp', []);
app.directive('myDirective', myDirective);
function myDirective() {
return {
scope: {},
bindToController: {
obj: '=',
message: '@'
},
controller: myController,
controllerAs: 'ctrl',
template: '<div>{{ctrl.obj.text}} {{ctrl.message}}</div>'
};
}
function myController() {
console.log(this);
}
})();