AngularDart ng-change [英] AngularDart ng-change
本文介绍了AngularDart ng-change的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有html:
<select ng-model="main.selectedReport" ng-change="main.selectReport()">
<option value="">Not selected</option>
<option ng-repeat="rep in main.reports" value="{{rep.value1}}">{{rep.value2}}</option>
</select>
我的控制器是:
@NgController(selector: '[main-controller]', publishAs: 'main')
class MainController extends FCViewAbstractController {
Map reports;
Long selectedReport;
....
selectReport() {
print(selectedReport);
}
}
我的问题是为什么我得到以前选择的值selectReport()?
例如:在第一次选择时,我得到了空值。
My question is why do I get previous selected value in selectReport()? For example: on first selection I got null value.
但是angularjs中的版本像我预期的 http://plnkr.co/edit/ILBBWfkRp9tegQZaGZ9u?p=preview
But version in angularjs works as I expect http://plnkr.co/edit/ILBBWfkRp9tegQZaGZ9u?p=preview
推荐答案
似乎是已知的错误
ng-在模型更新之前调用的更改#399
一种解决方法:
selectReport() {
new Future(() => print(selectedReport));
}
这篇关于AngularDart ng-change的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文