如何在角料将数据传递到$ mdDialog [英] How pass data to $mdDialog in angular material

查看:350
本文介绍了如何在角料将数据传递到$ mdDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过一些数据来$ mdDialog。其实我有单独的文件拖控制器。这里是我的控制器code

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

        })
    }

我要TP提供ProfileID传递给ProfileController可与显示配置文件数据。在配置文件控制,我得到的数据,因为这

I want tp pass profileId to profileController and display profile data. In profile controller i get data as this

function profileController($scope,..., profileId){

}

但在控制台此错误apear

but this error apear in console

  Error: [$injector:unpr] Unknown provider: profileIdProvider <- profileId<- ProfileController

这是什么错误,以及如何解决它?

what is this error and how to fix it?

推荐答案

我添加了NG-控制器=ProfileController可为ProfileController可,是由于一个错误。通过删除我的问题解决了。

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

这篇关于如何在角料将数据传递到$ mdDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆