/* AngularJS v1.2.9 */
/**
* 监控方法
* $watch 方法名
* $watch('变量名',function (改变后的数据,之前的数据) {})
*/
$scope.$watch('entity.goods.category1Id',function (newValue,oldValue) {
alert(newValue);
});
本文详细介绍了如何在AngularJS v1.2.9中使用$watch方法来监听变量的变化。通过实例展示了$watch方法的基本语法及如何在变量变化时执行特定函数。
/* AngularJS v1.2.9 */
/**
* 监控方法
* $watch 方法名
* $watch('变量名',function (改变后的数据,之前的数据) {})
*/
$scope.$watch('entity.goods.category1Id',function (newValue,oldValue) {
alert(newValue);
});
357
242

被折叠的 条评论
为什么被折叠?
