Created
August 13, 2015 06:47
-
-
Save adhamankar/ff2031f5a27414000cf5 to your computer and use it in GitHub Desktop.
Localization provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myApp.provider("Localization", { | |
loadResource: ["Localization", (Localization) => | |
Localization.loadResource(this.resourceName === undefined || this.resourceName === null ? this.controller : this.resourceName) | |
], | |
$get: ["$http", ($http: angular.IHttpService) => { | |
return { | |
loadResource: (resourceName?: string) => $http.get("<localization api>") | |
}; | |
}] | |
}) | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.config([<any> "$stateProvider", "LocalizationProvider" | |
, function ($stateProvider: ng.ui.IStateProvider, LocalizationProvider: any) { | |
$stateProvider | |
.state("projects", { | |
url: "^/projects", | |
templateUrl: "app/projects/projects.tpl.html" | |
, controller: "ProjectsCtrl" | |
, resolve: { resx: LocalizationProvider.loadResource } | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ProjectsCtrl extends BaseCtrl { | |
public static $inject = ["$scope", "resx"]; | |
constructor(public $scope: Common.Framework.IControllerScope<ProjectsCtrl> | |
, public resx: Array<any>) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment