I m actually creating a little directive and I m facing a problem with the scope object and controllAs.
In fact, I have this result :
angular.module('app')
.directive('historyConnection', function () {
return {
templateUrl: 'views/directives/historyconnection.html',
restrict: 'E',
scope: {
idUser: '@iduser'
},
controller:function($scope){
console.log(this.idUser); // gives undefined
console.log($scope.idUser); // gives the good value
},
controllerAs:'history'
};
});
From the html code :
<history-connection iduser="55"></history-connection>
I dont know how to make controllerAs work when passing parameters to directive. Can you help me ?
Important informations are commented in the javascript code above