When working with Angular, you can include simple expressions like {{ 5 + 5 }} without any issues. However, more complex operations such as using angular.forEach to iterate over an array and log specific values do not work as expected.
{{ angular.forEach(something, function(item){
console.log(item._id);
}); }}
I really want this functionality to work because I need to combine ng-repeat while validating certain values in real time. If I validate these values in the controller, the changes are not dynamically tracked without a page refresh.
Does that make sense?
If I try to add an item to my data array, it would not trigger the forEach loop logging the new item's id if placed within the controller. The only way to see these changes reflected in the view is by refreshing the page since the data originates from a database.
While using {{ }} to display data works seamlessly without requiring a page reload, it restricts the capabilities of my code. How can I resolve this dilemma?