2 * egStrings : service for tracking page-specific string translations.
4 * Convience functions embedded herein are prefixed with "$" to avoid
5 * collisions with string keys, which are linked directly to the
8 * egStrings.A_STRING = 'hello, world {{foo}';
10 * egStrings.$replace(egStrings.A_STRING, {foo : 'bar'})
14 angular.module('egCoreMod').factory('egStrings',
15 ['$interpolate', '$rootScope', function($interpolate, $rootScope) {
18 '$replace' : function(str, args) {
20 return $interpolate(str)(args);
24 * Sets the page <title> value.
26 * The title is composed of a dynamic and static component.
27 * The dynamic component may optionally be compiled via
30 * The dynamic component is subject to truncation if it exceeds
31 * titleTruncLevel length and a context value is also applied.
33 * Only components that have values applied are used. When
34 * both have a value, they are combined into a single string
35 * separated by a - (by default).
38 setPageTitle : function(dynamic, context, dynargs) {
41 $rootScope.pageTitle = context || service.PAGE_TITLE_DEFAULT;
45 if (dynargs) dynamic = service.$replace(dynamic, dynargs);
48 $rootScope.pageTitle = dynamic;
52 // only truncate when it's competing with a context value
53 dynamic = dynamic.substring(0, service.titleTruncLevel);
55 $rootScope.pageTitle = service.$replace(
56 service.PAGE_TITLE_DYNAMIC_AND_CONTEXT, {