I want to pass some data to $mdDialog. In fact i have tow controller in separate file. here is my controller code
function openDialog(id) {
$mdDialog.show({
locals:{
profileId: id
},
controller: ['$scope', 'profileId', function($scope, profileId) {
var self = this;
self.profileId= profileId;
}],
controllerAs: 'profileCtrl',
templateUrl: 'view/profile.html',
parent: angular.element(document.body),
clickOutsideToClose:true
})
}
I want tp pass profileId to profileController and display profile data. In profile controller i get data as this
function profileController($scope,..., profileId){
}
but this error apear in console
Error: [$injector:unpr] Unknown provider: profileIdProvider <- profileId<- ProfileController
what is this error and how to fix it?
I added
ng-controller="ProfileController as profileController"
in profile template and this was due to an error. By removing it my problem solved.Take the fast route!
$scope.items
can now be used in the dialog template ☺I think you must do this:
Your profileId Is in the scope.
You can use locals to pass data: Exemple from official website:
Where items is a data passed to the dialog