[SOLVED] AngularJS integration, invoking event defined in config object

Hi,

We are building an application with Angular JS and Webix as strict specification :).

How to invoke function (say “accountSelected” ) marked in config initialization which is defined in angular scope of same controller,

HTML :

<html xmlns:ng="http://angularjs.org" ng-app="accountSearchApp">
<body ng-controller="searchController">
	<div webix-ui="datatable_config" ></div>
</body>
</html>

SCRIPT :

var accountSearchApp = angular.module('accountSearchApp', [ "webix" ]);

// defining controller
accountSearchApp
		.controller("searchController", function($scope){

	$scope.datatable_config = {
						id: "dt_01",
						view:"datatable",
						columns:[
							{id:"edit", header:["Choose", {
								content:"textFilter", placeholder:"Type here to filter the grid",
								compare:oneForAll, colspan:2
								}], width:200,  template:"<a href='javascript:void(0)' onclick='accountSelected()'>Select</a>" 
							},
							{ id:"AccountName",	header:["Account Name",null],	width:300,	sort:"string"},
						],
						data: arryObj
	};

	$scope.accountSelected = function(){
		console.log(" SUCCESS ");
	}
});

Am able to invoke when function accountSelected definition is placed outside of controller scope, I need it working with func defined inside controller scope.

Thanks

js code in the templates is not pre-processed in any way, so you can’t access scope directly from it, but you can use a onClick property of datatable and call necessary method from it

http://webix.com/snippet/246a391f

The shorter notation is not work in this version, but will work in oncoming Webix 1.8

onClick:{
  "selectLink":"accountSelected"
}

Thanks Maksim. It worked like a charm! :slight_smile:

Just so it would help others and to save tech expert’s time I marked it [SOLVED] in subject. :slight_smile: