更新时间:2022-06-22 01:43:03
您需要保持这一基准的功能的启动和使用。 这个
我相信在您的函数是全局窗口的情况下。这一切都取决于函数是如何调用,并且它在哪里定义。
You need to keep the reference of this at the start of the function and use that. The context of this
i believe in your function is the global window. It all depends upon how the function is invoked and where is it defined.
app.controller('ChildCtrl', function($scope) {
var self=this;
$scope.name1 = 'Child';
this.name1 = 'Child';
this.option = {};
this.option.abc = 25;
foo = function(){
alert(self.option)
};
foo();
});