[英]Failed to load template in angular $mdDailog
I am using $mdDailog in my angularjs application.I have addUser() function which is called on ng-click operation. 我在我的angularjs应用程序中使用$ mdDailog。我有在ng-click操作上调用的addUser()函数。 Inside addUser() am using $mdDailog.show(). 在addUser()内部,使用$ mdDailog.show()。 Where I am passing html file path in templateUrl to load. 我在哪里传递要加载的templateUrl中的html文件路径。
I am getting error as Error: [$compile:tpload] Failed to load template: editUser.html 我收到以下错误消息:[$ compile:tpload]无法加载模板:editUser.html
Controller Function: 控制器功能:
function addUser(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'editUser.html',
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose: true,
});
Index.html : Index.html :
<md-button class="md-padding" id="popupContainer" ng-click="vm.addUser($event)" ng-cloak>Add User</md-button>
editUser.html: editUser.html:
<div>
<md-dialog aria-label="Mango (Fruit)">
<p>Here I will place my input elements</p>
</md-dialog>
</div>
您必须传递相对于基本URL的路径:
templateUrl: '/{PATH_TO_THIS_FILE}/editUser.html',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.