View/Page override

You can write your on cshtml to override the built in page renderer of Turnkey.

Accessing the angular $scope in javascipt code called from inside a page

If used in an element, this code gets the current scope.

angular.element(this).scope()

From "anywhere" this will get the scope of the current element

angular.element($0).scope()
Example with delayed calling of functions

For example, using this in an onclick event (NOT ng-click) will call the function DelayedSave in the script tag of the overridden page.

Note that a button can have both an ng-click and a onclick defined and both will be called.

onclick="DelayedSave(angular.element(this).scope())"

This example calls an action in the ViewModel called LazySave to save changes 2 seconds after the action with the onclick is executed.

<script>
  function DelayedSave(scope) {
  setTimeout(function () {
      scope.StreamingViewModelClient.CallServerAction('JournalSeeker', 'LazySave');
    }, 2000);
  };
</script>

More reading on how to make on-click work in an angular page

Ng-click ( ngClick ) not working

Se also EXT Components for overriding only a viewmodel attribute with your own code.

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