I have an app template that needs page-title parameter, but how?

26 views
Skip to first unread message

Frank Tudor

unread,
Apr 15, 2015, 3:08:02 PM4/15/15
to ang...@googlegroups.com
This might be elementary but I am treading water and cannot find a good example from Google Search.

The problem I have is I need to populate the page title to the app-template page-title parameter using {{pageTitle}} It is part of the scope but some how I need to fish out the basic nav current page (that I am on and pop that puppy here.

How do I do this?

Thanks,
Frank
....

<html ng-app="VizMe" hover-stop="" class="ng-scope">
<body ng-controller="ctrlr" class="ng-scope">
<macc-app-template 
app-title="Visualize" 
   page-title="{{pageTitle}}"  <<< How???
   nav-content="nav" 
   class="ng-isolate-scope">
....


<script>
angular.module('VizMe', ['macc']).controller('ctrlr', ['$scope', 
function($scope) {
  var basicNav = [
  {label:'Home',
   url:'index.cfm?template=a'},
  {label:'MACC Gear',
     url:'index.cfm?template=b'},
  {label:'Alatus',
     url:'index.cfm?template=d'},   <<<< the lbael from this needs to get to a the pageTitle variable below....
  {label:'Osteons',
     url:'index.cfm?template=e'}
     ];
  var noNav = [];
  $scope.showNav = true;
  $scope.nav = basicNav;
  $scope.setNav = function(showNav) {
  $scope.nav = showNav ? basicNav : noNav;
  };
  $scope.pageTitle = 'Need label of the current page to populate here?'; <<< How???
}]);
</script>

Luke Kende

unread,
Apr 16, 2015, 1:05:56 AM4/16/15
to ang...@googlegroups.com
Just as plain-ol-javascript would use window.document.title... angular has a safe reference to $window 

$window.document.title

Just inject it into your controller to use it.

BUT... you're example looks like a different question.  You just need to keep up with a reference to the current nav's current selected index and set $scope.pageTitle = basicNav[index].label.

...if I understand your code correctly.

Frank Tudor

unread,
Apr 16, 2015, 9:32:13 AM4/16/15
to ang...@googlegroups.com
Thanks I will give this a shot...

Frank
Reply all
Reply to author
Forward
0 new messages