I'm using a directive with the controllerAs syntax. I want to use 2 instances of that directive, which both need to have non shared data. My problem, it seems that there is only controller instance.
There seems to be the option to add to the directive declaration a scope : {}. But then I would be forced to use the scope based access?
Or is there any other way to still using the controllerAs/this syntax and enforcing angular to create 2 distinct controller object?
app.directive('createA', function() {
return {
restrict : 'E',
templateUrl : '/template/createActivity',
// using this to create 2 distinct scopes
// but then I can't use the this/caCtrl.data syntax?
scope : {},
controller : function($scope, $rootScope) {
// using this syntax to access data
// in tempate like {{ caCtrl.data }}
this.data = '123';
},
controllerAs : 'caCtrl'
};
});