SSH SSH - 5 months ago 217
AngularJS Question

How pass data to $mdDialog in angular material

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?

SSH SSH
Answer

I added ng-controller="ProfileController as profileController" in profile template and this was due to an error. By removing it my problem solved.

Comments