-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 using a directive inside a cell template #743
Comments
In your example, you have the model property on the directive setup with a two-way binding ('='), but you are not watching for changes. When you filter the rows using the grid's search box, the model property changes but the data object that you created in the link function of the directive does not get updated. To fix this, you can either not use the data object in the directive or use setup a $watch on 'model' to update the datat object.
|
Thanks for the info! I'm still confused why you need to watch the model if there's 2-way binding? Originally I did not have the data object but had the same problem. I've updated the plunker to demonstrate. |
With the updated version of your plunk, you are storing off the id of the model.
This is a one time assignment not a binding to You can either use the watch that you have commented out or use the following as your template.
Using this template accesses the id off the model object which has the binding, so when the model changes, the UI will reflect the changes. |
Awesome explanation. Looks like I was over-complicating things. Thanks! |
If you use the grid's built-in search filter and type in the number 2, you will see that the row.entity from the grid model is not in sync with the directive model's output.
http://plnkr.co/edit/N1yxj6U6Or0ttnsLfHLB
Related to this issue? #527
The text was updated successfully, but these errors were encountered: