Set Page Title In AngularJS

Posted by Weston Ganger

I usually like to set page titles on my angular templates.

var myApp = angular.module('myApp', ['ngResource']);

myApp.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/', {
    title: 'Home',
    templateUrl: '/assets/views/home.html',
    controller: 'HomeController'
  $routeProvider.when('/Product/:id', {
    title: 'Product',
    templateUrl: '/assets/views/product.html',
    controller: 'ProductController'
}]);['$location', '$rootScope', function($location, $rootScope) {
  $rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
    $rootScope.title = current.$$route.title;

Related External Links:

Article Topic:Software Development - Angular

Date:July 19, 2015

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected