Wednesday, 7 September 2016

Angular JS - Update View text from contoller using $rootScope

Angular JS -  Update View text from contoller using $rootScope 
=======================================

if(!rootScope.sitename)
    {
        rootScope.sitename = "App";
        rootScope.searchcol =  "App";
    }

$scope.SearchDashboard = function(sitename, searchcol){
        rootScope.sitename = sitename; 
        rootScope.searchcol =  searchcol;
        $location.path('dashboard/'+'-'+sitename)  //reload the page to update
    }



view:
=======
  <a href="" ng-click="SearchDashboard(sitename,'Site')" title=" {{sitename}}" class="ng-binding">   {{sitename}}</a>

No comments:

Post a Comment

KISS, DRY, SOLID, YAGNI — A Simple Guide to Some Principles of Software Engineering and Clean Code

1 — KISS (Keep It Simple, Stupid)  Simplicity triumphs over complexity. Direct and clear codes are better for developing, maintaining, and s...