Angularjs Problem Aggregation

Source: Internet
Author: User

1, with the Ng-repeat loop output encountered very strange problem:

Error: [Ngrepeat:dupes] Http://errors.angularjs.org/1.4.6/ngRepeat/dupes?p0=x%20in%20result&p1=stri ... 83%ef%bc%8c%e7%bb%93%e6%9e%9c%e6%98%af%ef%bc%9a%e4%bd%a0%e8%be%93%e4%ba%86

At Angular.min.js:6

At angular.min.js:279

At Object.fn (angular.min.js:129)

At N. $digest (angular.min.js:130)

At N. $apply (angular.min.js:133)

At Htmlinputelement.<anonymous> (angular.min.js:253)

At Htmlinputelement.c (angular.min.js:35)

This means that ng-repeat cannot have duplicate data: solution: ng-repeat= "keys in NewList track by $index", plus track by $index, or trace by any of the normal values, As long as you can uniquely identify each item in the array, you can

2, data two-way binding failure, is clearly in the controller inside to $scope.xxx assignment, on the page xxx leng display, but click on the input box or form form of the submit button, XXX data information is displayed.

Workaround: Add $scope. $apply ();

$scope. $apply (function

$scope. XXX = "You assign the value";

});

In general, we do not need to add this code manually, because the ANGULARJS itself is called when needed in order to achieve the effect we see the data two-way binding.

But if you refer to an external plug-in or other, create or update $scope in the callback function . XXX data, because the external plug-in itself has been out of the scope of ANGULARJS, so data bidirectional binding here is not effective, can only be manually added $scope.$ Apply () to notify the page to get the data.

Reference URL: http://www.bdqn.cn/news/201409/15295.shtml

Angularjs Problem Aggregation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.