简体   繁体   English

更改输入后如何调用 function

[英]How to call function after change input

Using Angular 1.6使用 Angular 1.6

I´m trying to call some function like $scope.myFunction after change inputs我正在尝试在更改输入后调用一些 function 之类的$scope.myFunction

My code look like this我的代码看起来像这样

<md-input-container class="col-sm-12 md-block no-left-padding">
                        <label>Name</label>
                        <input name="name" ng-model="name" onfocusout="myFunction()">
</md-input-container>

I´m getting this error when I unfocus the input当我不聚焦输入时出现此错误

Uncaught ReferenceError: myFunction is not defined
    at HTMLInputElement.onfocusout

onfocusout behaves similar to onclick - it is standard JavaScript callbacks. onfocusout行为类似于onclick - 它是标准的 JavaScript 回调。 To call function from scope/controller you need ng-* , probably you will be happy with ng-blur要从范围/控制器调用 function 您需要ng-* ,您可能会对ng-blur感到满意

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM