Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when watching the table parameters for changes #327

Closed
yairy opened this issue May 26, 2014 · 0 comments
Closed

Problem when watching the table parameters for changes #327

yairy opened this issue May 26, 2014 · 0 comments

Comments

@yairy
Copy link

yairy commented May 26, 2014

When watching the table parameters for changes:

 $scope.$watch('params.$params', function (newParams, oldParams) { ... }

In the first invocation of the listener , newParams is equal to oldParams - this is because of angular limitation :

"After a watcher is registered with the scope, the listener fn is called asynchronously > (via $evalAsync) to initialize the watcher. In rare cases, this is undesirable because the listener is called when the result of watchExpression didn't change. To detect this scenario within the listener fn, you can compare the newVal and oldVal. If these two values are identical (===) then the listener was called due to initialization."

This has the side effect that the first call to getData will use the default getData and not the one provided by the user, because at this stage the settings weren't yet processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants