单击时单击angular-ui引导选项卡 [英] angular-ui bootstrap tab select function on click
本文介绍了单击时单击angular-ui引导选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用angular ui引导程序在选项卡选择上调用表达式函数,但是表达式并未被调用,而是在angular inspector上检查了函数/expression是否存在:以下是我的代码:
Am trying to call an expression function on tab select using angular ui bootstrap, however the expression is not being called but checking on angular inspector the function /expression exists : below is my code work:
NB:其他标签正常工作
NB : Other tabs function correctly
角度视图
<uib-tab ng-click="vm.alertMe" select="" heading="New Invoice">
.....
</uib-tab>
用作虚拟机的控制器
vm.alertMe = alertMe;
function alertMe() {
setTimeout(function() {
$window.alert('You\'ve selected the alert tab!');
});
}
推荐答案
总是注入您在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>
这篇关于单击时单击angular-ui引导选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文