javascript - 如何解决指令 'ngModel' 所需的 Controller 'ngChange' 找不到!异常(exception)?

标签 javascript angularjs angularjs-directive

我知道对于上述问题有很多答案,只是“指令”而不是 ngChange。我使用的是 1.7.2 版本。 这是我的代码

<select class="full-width" id="searchWithSavedFilter" ng-modal="searchWithSavedFilter" ng-change="test(searchWithSavedFilter)">
 <option ng-repeat="p in SavedFilters" value="{{p.Id}}">{{p.Name}}</option>
</select>

angularjs引用代码为

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.2/angular.min.js"></script>

最佳答案

如错误所述,您需要 ng-model 而不是 ng-modal

<select class="full-width" id="searchWithSavedFilter" ng-model="searchWithSavedFilter" ng-change="test(searchWithSavedFilter)">

关于javascript - 如何解决指令 'ngModel' 所需的 Controller 'ngChange' 找不到!异常(exception)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52578319/

相关文章:

angularjs - 输入指令中的 setViewValue 不更新实际可见输入值

javascript - 如何在页面滚动或调整大小时更新指令

javascript - Laravel 5.3、Vue.js 2+ 无法使列表渲染 (v-for) 工作

javascript - 哪个函数声明更快? var functionName 或 this.functionname

html - AngularJS 错误,值未替换 {{clientCount}}

javascript - 如何使用 Angularjs 从 url 显示 youtube 缩略图

angularjs - 在 Angular 中创建 "App-Wide"消息系统

javascript - 使用我的时区在我的网站上显示推文

Javascript onscroll 事件未被调用

javascript - 如何在不使用客户端缓存的情况下下载新版本的文件?