View/Page override
(Replacing message template with parser tag)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 21: Line 21:
   };
   };
  </script>
  </script>
Read more on how to make on-click work on an angular page: [[Ng-click ( ngClick ) not working]]
Read more on how to make on-click work on an angular page: [[Documentation:Ng-click ( ngClick ) not working|Ng-click ( ngClick ) not working]]
 
See also [[Documentation:EXT Components|EXT Components]] for overriding only a ViewModel attribute with your own code.


See also [[EXT Components]] for overriding only a ViewModel attribute with your own code.
[[Category:MDriven Turnkey]]
[[Category:MDriven Turnkey]]
[[Category:View Model]]
[[Category:View Model]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Latest revision as of 05:11, 23 January 2025

This page was created by Lars.olofsson@mdriven.net on 2022-04-26. Last edited by Stephanie@mdriven.net on 2025-01-23.

You can write your own cshtml to override the built-in page renderer in Turnkey.

Accessing the Angular $scope in Javascipt Code Called Inside a Page

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

angular.element(this).scope()

This will get the scope of the current element from "anywhere"

angular.element($0).scope()
An Example with Delayed Calling of Functions

For example, using this in an on-click 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 an on-click 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 on-click is executed.

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

Read more on how to make on-click work on an angular page: Ng-click ( ngClick ) not working

See also EXT Components for overriding only a ViewModel attribute with your own code.