Child pages
  • Specification (.spec file)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleserverside script
$scope.mycallback = function(name,type) {
	return "something";
}

Since Servoy 8.2 you must also define these functions in a special Api category of the spec, internalApi:. In prior versions define these in api section instead.

Code Block
languagejs
titleserverside script
"internalApi":
	{
		"mycallback " :{
			"returns": "string",
	         "parameters":[
	            				{
						            "name":"name",
						            "type":"string"
					            },
					            {
						            "name":"type",
						            "type":"string"
						        }
	            			 ]
		}
	}

...

Code Block
languagejs
titleclient javascript
  // assign to the scope the svy-servoyapi
  scope: {
    	  model: '=svyModel',
		  servoyApi: '=svyServoyapi'
      },
 
// in the controller or link functions you can use that then
 $scope.servoyApi.callServerSideApi("mycallback",["test",1]).then(function(retValue) {
   console.log(retValue);    
 });

...

the callServerSideApi wants to have the function name and an array of arguments, it returns a promise of angular where the then function will give you the return value of the callback.

...