Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Ability to enhance how watch checks for equality for my own classes #5929

Closed
lee-elenbaas opened this issue Jan 22, 2014 · 3 comments
Closed

Comments

@lee-elenbaas
Copy link

If i have a complex class MyClass that has many properties, i can usually provide better implementation for testing equality for that class then the default angular.equals.

Ffor my own watch i can optimize them by making sure i only perform watch on the specific state properties. but if my code uses some library, i can not customize the way that library perform its watch on my objects

The simplest example is an ng-repeat on an array of such objects

So i am looking for a way that i can enhance the equals mechanism used inside angular to fit better the specific SPA.

One possible option i presented in this pull request #5913

@btford
Copy link
Contributor

btford commented Jan 23, 2014

Is there a reason you can't use track by?

@caitp
Copy link
Contributor

caitp commented Jan 23, 2014

I don't think we can really do this and make it part of the API... Something which is doable for your own app is to patch AngularJS manually, if you don't have a way to monkey-patch a particular part of it.

There are some articles out there which can help you monkey-patch angular for some particular performance enhancements (http://blog.scalyr.com/2013/10/31/angularjs-1200ms-to-35ms/ is one), and maybe some of these perf enhancements will make it into core some day, who knows.

If there are proper perf concerns with ngRepeat (which there certainly are) which don't involve enabling monkey-patching, then that's something which is much easier to deal with.

@gkalpak
Copy link
Member

gkalpak commented May 31, 2016

This has been discussed in several issues. Closing as duplicate of #10069 (which has an associated PR). Let's move the discussion there.

@gkalpak gkalpak closed this as completed May 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants