SSH SSH - 1 year ago 571
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) {
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),


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?

Answer Source

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