Search code examples
angularjsangularjs-ng-repeathidden

Script block not working in AngularJS ng-repeat section


The script block not working in AngularJS ng-repeat section. The issue is given below.

<div ng-repeat="user in users">
  <input type="text" ng-model="{{user.mobile}}" ng-value ="{{user.mobile}}">

  <script>
    $(function () {
        var mobile ="{{user.mobile}}";
        alert("{{user.mobile}}");            
    });
 </script>
</div>

Solution

  • Script-tags in AngularJS expression will not evaluate. This is also not the way you want to do this. Do this in a controller, directive, but not in your DOM.

    https://groups.google.com/forum/?fromgroups#!topic/angular/9d-rhMiXDmg