Finding angular scope from javascript

Working with EXT_Components and integrating towards other services you may end up in situations where you get callbacks in client side javascript - and you will want to catch data from such a callback.

To get hold of your objects from such a callback (that are outside of the normal angular realm where you have some scope information at hand) you can go like this:

var vmroot=angular.element('#some-element-within-html-that-is-your-view').controller().$scope.ViewModelRoot;

You now have the current local representation of your ViewModel in the vmroot variable and you can set properties like this:

vmroot.MyViewModelColumn=somevalueFromACallBack;

MDrivenTurnkey sees the property you change and handles signaling of server and binding of UI.

This page was edited 87 days ago on 02/10/2024. What links here