Page History
...
Code Block | ||
---|---|---|
| ||
angular.module('testservice',['servoy']) .factory("testservice",function($window,$services) { var state = $services.getServiceState('testservice'); return { talk: function() { alert("talk: " + state.text); state.text = "something else" } } }) .run(function($rootScope,$services) { var scope = $rootScope.$new(true); scope.state = $services.getServiceState('testservice'); scope.$watch('state', function(newvalue,oldvalue) { // handle state changes }, true); }) |
From scripting, when calling plugins.testservice.talk() it should execute the service talk method. The service model is automatically synchronized with the server. In order to observe server side modifications the service must add a watch to the service state.
Overview
Content Tools
Activity