小编Nar*_*h k的帖子

在同一个Controller Angular Js中将函数调用到另一个函数中

我是新手使用angularjs并且我已经在控制器中声明了两个函数,现在我想将一个函数用于另一个函数我该怎么做才意味着如果我将函数名称称为另一个函数,它说Undefined.

这是代码:

'use strict';
angular.module('customer').controller('Controller', ['$scope', '$state', 'Sservice',
  function($scope, $state, Sservice) {

    var that = this;

    (function getDetails() {
        //IMPLEMENTATION
    }());

    this.function2 = function function2 (id){
        //implementation
      getDetails(); // says undefined
    };
  }
]);
Run Code Online (Sandbox Code Playgroud)

function angularjs

8
推荐指数
1
解决办法
8万
查看次数

标签 统计

angularjs ×1

function ×1