externalized configuration into index.appConfig file

This commit is contained in:
Nils Norman Haukås 2015-11-14 20:14:10 +01:00
parent 6f05e601b7
commit bad3c2e2e3
5 changed files with 58 additions and 3 deletions

14
src/index.appConfig.ts Normal file
View file

@ -0,0 +1,14 @@
/// <reference path="../typings/tsd.d.ts" />
module tagIt {
/** @ngInject */
export function AppConfigInitializer ($logProvider: ng.ILogProvider) {
$logProvider.debugEnabled(true);
}
export class AppConfigService {
serverUrl = 'http://lexitags.dyndns.org/server/lexitags2/Semtags?data=';
}
}

View file

@ -1,14 +1,19 @@
/// <reference path="../typings/tsd.d.ts" />
/// <reference path="index.appConfig.ts" />
/// <reference path="menu/menu.controller.ts" />
/// <reference path="services/backend.service.ts" />
/// <reference path="services/webPage.service.ts" />
/// <reference path="services/webpage.service.ts" />
/// <reference path="services/tag.service.ts" />
module tagIt {
angular.module('tagit', [])
.config(AppConfigInitializer)
.service('AppConfigService', AppConfigService)
.service('BackendService', BackendService)
.service('WebPageService', WebPageService)
.service('TagService', TagService)
.controller('MenuCtrl', MenuCtrl);
export function init (callback: () => void) {

View file

@ -1,4 +1,5 @@
/// <reference path="../index.interfaces.ts" />
/// <reference path="../index.appConfig.ts" />
'use strict';
@ -8,12 +9,13 @@ module tagIt {
$http : ng.IHttpService;
$log : ng.ILogService;
private serverUrl = 'http://lexitags.dyndns.org/server/lexitags2/Semtags?data=';
private serverUrl : string = null;
/* @ngInject */
constructor($http: ng.IHttpService, $log: ng.ILogService) {
constructor($http: ng.IHttpService, $log: ng.ILogService, AppConfigService: AppConfigService) {
this.$http = $http;
this.$log = $log;
this.serverUrl = AppConfigService.serverUrl;
}
callServer (word: string) {

View file

@ -0,0 +1,34 @@
/// <reference path="../index.interfaces.ts" />
'use strict';
// responsible for saving and loading
// any tags related to the current page
module tagIt {
export class TagService {
$http : ng.IHttpService;
$log : ng.ILogService;
/* @ngInject */
constructor($http: ng.IHttpService, $log: ng.ILogService) {
this.$http = $http;
this.$log = $log;
}
// save selection
saveTag () {
}
loadTag () {
}
loadTags () {
this.$log.debug('loadTags');
}
}
}