Super Basic functionality advice

I am looking for some super basic advice on how NG Components interact with Servoy

  1. I want to call a Servoy form function from a component

  2. I want to pass a variable or call a function within a service

In various posts I have seen things like “svyServoyapi” are these items built in and if so is there a list anywhere as I have thus far hit the wall on finding anything in the wiki.

I guess the fundamental problem is my understanding of the concept of NG Client and components is not yet at a point the wiki is making any sense. Ironically I can do all of this is raw angular which rather defeats the object of Servoy sadly

help much appreciated

I have a simple button component that outputs a message to the console - so this function works

html:

<div><button class="btn btn-info" ng-click="onClick($event)">test</button></div>

Spec:

{
	"name": "gordon-test-Button",
	"displayName": "testButton",
	"version": 1,
	"definition": "gordon/testButton/testButton.js",
	"libraries": [],
	"model":
	{
		"yourName" : {"type": "string", "default":"World"}
	}
}

JS File:

angular.module('gordonTestButton',['servoy']).directive('gordonTestButton', function() {  
    return {
      restrict: 'E',
      scope: {
    	  model: '=svyModel', 
		  handlers: "=svyHandlers",
          api: "=svyApi",
          svyServoyapi: "="
      },
      controller: function($scope, $element, $attrs) {
      },
      link: function (scope, element, attrs) {
    	  
          scope.onClick= function (event) {
        	  console.log('Button clicked')
        	  //scope.svyServoyapi.apply('dataProviderID');
        };
      },
      templateUrl: 'gordon/testButton/testButton.html'
    };
  })

I’d suggest reviewing the source code of the components that are included with Servoy: https://github.com/Servoy/servoy-client … client/war
I’ve also made a sample on Servoy Forge: https://www.servoyforge.net/projects/se … nents/wiki

In your model, you need to define some handlers, like the “onActionMethodID” here: https://github.com/Servoy/servoy-client … utton.spec

Then in your HTML, you can use ```
svy-click=‘handlers.onActionMethodID($event)’


By defining it in the Model, it will show up in the Properties area in Servoy Developer. So you can assign whatever function you want to that onActionMethodID. Then it gets triggered in the HTML.

goldcougar:
I’d suggest reviewing the source code of the components that are included with Servoy: https://github.com/Servoy/servoy-client … client/war
I’ve also made a sample on Servoy Forge: https://www.servoyforge.net/projects/se … nents/wiki

In your model, you need to define some handlers, like the “onActionMethodID” here: https://github.com/Servoy/servoy-client … utton.spec

Then in your HTML, you can use ```
svy-click=‘handlers.onActionMethodID($event)’


By defining it in the Model, it will show up in the Properties area in Servoy Developer. So you can assign whatever function you want to that onActionMethodID. Then it gets triggered in the HTML.

Thanks Scott and Paolo@servoy, I had forgotten, or more to the point not fully understood, that a custom component was a stand alone object in its own right. This custom object is not part of your Servoy solution more an enhancement that is added to Servoy developer that you can incorporate in all your solutions. As an example this could be a multi function custom button with your own design tweaks.

For the benefit of others Servoy 8 and the NG Client can be used in exactly the same way as Servoy 7 with the massive advantage its a LOT more versatile, easier to debug and potentially a lot faster.

Thanks again guys appreciated and REALLY looking forward to @ServoyUniversity training for version 8 !!

Gordon