我正在尝试创建一个登录页面。我的登录页面上有一个控制器。点击按钮我正在显示警报。但它没有显示。我创建了一个控制器模块,为什么我不能创建plunker或小提琴。我将分享我编写控制器的小代码。
LoginCtrl.js
Accounts.onCreateUser(function(options, user) {
...
Meteor.setTimeout(function () {
Roles.addUsersToRoles(user._id, roles, group);
},0);
...
});
controller.js
define(function () {
'use strict';
function ctrl($scope, $state) {
$scope.login = function () {
alert("--")
};
}
ctrl.$inject = ['$scope', '$state'];
return ctrl;
});
答案 0 :(得分:0)
Make sure in your HTML file you have added the controller name to the parent element or the appropriate element.You need to give the same controller name in both your HTML file and also the js file. Make sure your controller file is included in your index.html file.