내 응용 프로그램 컨트롤러에 다음과 같은 기능을 사용하고 있습니다 :AngularJS가 내 변수 값이 변경된 것을 인식하지 못하는 이유는 무엇입니까?
this.state = {
net: false,
netd: false,
network: function (active) {
if (active) {
this.state.net = true;
t = window.setTimeout(function() {
this.state.netd = true;
}.bind(this), 500);
} else {
window.clearTimeout(t);
this.state.net = false;
this.state.netd = false;
}
}.bind(this)
};
을 내 아이 컨트롤러에서 나는 다음과 같이 호출 :
app.state.network(true);
그리고 잠시 후 :
app.state.network(false);
에서 내 아이디 HTML net과 netd를 다음과 같이 보았습니다 :
xx {{ app.state.net }} yy
xx {{ app.state.netd }} yy
네트워크 기능은 예상대로 호출되고 난에서 xx {{ app.state.net }} yy
변화를 볼 수있다>는 false하지만 디버거가 여기에 true로 설정해야 얻을 보여줍니다에도 불구하고 xx {{ app.state.netd }} yy
은 항상 false입니다 : this.state.netd = true;
이
사람이 말해 줄 수 왜 내 netd의 상태가 브라우저에서 변경되지 않는 것 같습니까?