Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 角度ui引导选项卡单击选择函数_Angularjs_Angular Ui Bootstrap - Fatal编程技术网

Angularjs 角度ui引导选项卡单击选择函数

Angularjs 角度ui引导选项卡单击选择函数,angularjs,angular-ui-bootstrap,Angularjs,Angular Ui Bootstrap,我试图使用angular ui引导调用tab select上的表达式函数,但未调用表达式,但正在angular inspector上检查函数/表达式是否存在:以下是我的代码工作: 注意:其他选项卡功能正常 角度视图 为什么不直接在vm上定义alertMe函数呢。我看不到你的全部代码。我认为,如果您的虚拟机在控制器中被正确分配为该虚拟机,那么它应该可以工作。还要确保在html中正确定义了控制器。让我知道: vm.alertMe = function() { setTim

我试图使用angular ui引导调用tab select上的表达式函数,但未调用表达式,但正在angular inspector上检查函数/表达式是否存在:以下是我的代码工作:

注意:其他选项卡功能正常

角度视图


为什么不直接在vm上定义alertMe函数呢。我看不到你的全部代码。我认为,如果您的虚拟机在控制器中被正确分配为该虚拟机,那么它应该可以工作。还要确保在html中正确定义了控制器。让我知道:

vm.alertMe = function() {
              setTimeout(function() {
               $window.alert('You\'ve selected the alert tab!');
              });
             } 

为什么不直接在vm上定义alertMe函数呢。我看不到你的全部代码。我认为,如果您的虚拟机在控制器中被正确分配为该虚拟机,那么它应该可以工作。还要确保在html中正确定义了控制器。让我知道:

vm.alertMe = function() {
              setTimeout(function() {
               $window.alert('You\'ve selected the alert tab!');
              });
             } 

您没有在DOM中调用该函数

与此相反:

<uib-tab ng-click="vm.alertMe" select="" heading="New Invoice">
你应该这样称呼它:

<uib-tab ng-click="vm.alertMe()" select="" heading="New Invoice">

您没有在DOM中调用该函数

与此相反:

<uib-tab ng-click="vm.alertMe" select="" heading="New Invoice">
你应该这样称呼它:

<uib-tab ng-click="vm.alertMe()" select="" heading="New Invoice">

始终注入angular应用程序中使用的基本服务名称,在上面的示例中,我没有调用:$window service,这导致了错误/错误。我的最终控制器如下所示:

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应用程序中使用的基本服务名称,在上面的示例中,我没有调用:$window service,这导致了错误/错误。我的最终控制器如下所示:

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>

我解决了这个问题:我没有给控制器打$window服务,你的意思是你忘了注射它?哦,是的,有点急着要完成应用程序!我解决了这个问题:我没有给控制器打$window服务,你的意思是你忘了注射它?哦,是的,有点急着要完成应用程序!请不要将答案编辑到您的问题中。如果您有答案,请将其张贴在下面并标记为已接受。请不要将答案编辑到您的问题中。如果您有答案,请在下面发布,并将其标记为已接受。请参考上面的:我没有呼叫$window service请参考上面的:我没有呼叫$window service