Right place to add a common function which updates UI component in AngularJS -
i working on angularjs applicaion. ui divided 2 parts. on left side, have navigation tree panel. if user clicks on of item in tree, load corresponding page on right hand side. on of pages (load of right side panel), have provided button, loads page , update navigation tree panel.
currently, have copied logic @ multiple places updates navigation tree. wonder right place put logic?
i thinking of using this:
var mynamespace = mynamespace || {}; mynamespace.helpers = { isnotstring: function(str) { return (typeof str !== "string"); } };
in controller:
angular.module('app.controllers', []). controller('datactrl', ['$scope', function($scope) { $scope.helpers = mynamespace.helpers; });
or may add function root scope:
$rootscope.isnotstring = function(str) { return (typeof str !== "string"); }
Comments
Post a Comment