更新时间:2023-02-02 12:36:36
总是注入您在angular应用程序中使用的基本服务名称,在上面的示例中,我没有调用:$window
服务,导致了错误/错误.my的最终控制者如下:
Always inject the base service names you use in your angular app ,in the above example i was not calling : $window
service which resulted in the bug / error .my final controller is as following :
function() {
'use strict';
angular
.module('app.patients')
.controller('PatientsController', PatientsController);
PatientsController.$inject = ['$http','$window'];
/* @nginject */
function PatientsController($http, $window) {
vm.alertMe = function() {
$window.alert('You\'ve selected the alert tab!');
}
}
}
和视图,
<uib-tab select="vm.alertMe()" heading="New Invoice">
.....
</uib-tab>