這是我的代碼,但是ng-change從來沒有被調用過。有誰知道爲什麼?由於如何在ng-change事件中調用預定義的JavaScript函數?
<html ng-app="">
<head>
</head>
<body data-ng-init="names=['A', 'B', 'C']">
<script src="resources/js/angular/angular.min.js"></script>
<script src="resources/js/angular/angular.min.js.map"></script>
<select class="form-control input-sm"
ng-model="fda"
ng-change="alert('changed')"
ng-options= "value for value in names" >
</select>
</body>
</html>
你已經寫一個函數。例如:ng-change =「changefunction()」並在你的控制器中$ scope.changefunction = function(){alert(「changed」); } –
我認爲這是一個很好的問題,但它可能是'如何在ng-change事件中調用預定義的JavaScript函數?'我已經回答了這個意見 –