You can use the mechanism of the
prototype.
.when('/someUrl', {
template : ' ng-template="some.html">',
controller: function (data)
{
var pr = this;
pr.data = data;
},
controllerAs: 'pr',
resolve : {
data: ['Service', function
(Service) {
return Service.getData();
}]
}
})
angular.module('myApp')
.controller('MyController',
['$scope', function ($scope) {
$scope.data = $scope.pr.data;
//magic
}
]
);
Now wherever you
want to use
' ng-controller="MyController">
No comments:
Post a Comment