Page History
...
The difference between service and web component is that service doesn't have user interface (so also doesn't have html template). A service must contain the specification file and the js file. The service specification file is exactly the same as web component specification file. However, as there is no UI, there is no support for handlers. Service API can be called from scripting as a plugin.
Code Block | ||
---|---|---|
| ||
{
"name": "testservice",
"displayName": "Test service that says helloworld",
"definition": "servoyservices/testservice/testservice.js",
"libraries": [],
"model":
{
"text": "string"
},
"api":
{
"talk": {
}
}
}
|
The service js file must define the api from the spec:
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" } } }) |
Overview
Content Tools
Activity