JavaScript function:
var API = (function(){
return {
function invokeDirective(){
invvoke();
$scope.setItem() // to directive
}
}
});
Directive:
angular.module('sampleComponents', ['$strap.directives']).directive('titlebar',
function($filter,$timeout)
{
return {
restrict: 'AE',
replace: true,
scope: true,
transclude: true,
template: '<div class="searchBar r etc ........',
controller: function($scope,$http,$timeout)
{
$scope.setItem = function(){
// want to invoke this function from api.js -
}
}
link: function(scope, element, attrs){
// etc:
}
});
how can I invoke $scope.setItem from api.js? Is it possible? Please suggest.
(currently, I am using timer, but that is creating some performance issue )