Sha256: 9bc68582517156703e4a21154c42c16afed7b4604767e99aec47da4e43ebbb80

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

(function(angular){
  'use strict';

  var module = angular.module('herald.page' , []);

  module.factory('Page', ['$document', '$rootScope', function($document, $rootScope) {
    var root = $document;
    var base = root[0].title;
    var title = null;
    var target = null;
    var service = {
      title: function(newTitle, newTarget, joiner) {
        var merged = newTitle + '';
        if(typeof(joiner) === 'undefined') { joiner = ': '; }
        if (typeof(newTarget) !== 'undefined') {
          merged = merged + joiner + newTarget;
        }
        var whole = merged + ' | ' + base;
        root[0].title = whole;
        title = newTitle;
        target = newTarget;
        $rootScope.$emit('Page::titleChanged', title, target, merged, whole);
      },
      actualTitle: function() {
        return title;
      },
      actualTarget: function() {
        return target;
      }
    };
    return service;
  }]);

})(angular);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-herald-0.8.1 lib/puppet-herald/public/components/page.js
puppet-herald-0.8.0 lib/puppet-herald/public/components/page.js