add declare module

This commit is contained in:
Horiuchi_H
2014-05-12 14:45:19 +09:00
parent ff509b3f71
commit 3fe4b97009
2 changed files with 15 additions and 13 deletions
@@ -5,9 +5,9 @@ interface TestScope extends ng.IScope {
viewType: string;
}
module angularLocalStorageTests {
module ng.LocalStorageTests {
export class TestController {
constructor(private $scope: TestScope, private storage: AngularLocalStorageService) {
constructor(private $scope: TestScope, private storage: ng.localStorage.ILocalStorageService) {
storage.bind($scope, 'varName');
storage.bind($scope,'varName', { defaultValue: 'randomValue123', storeName: 'customStoreKey' });
$scope.viewType = 'ANYTHING';
@@ -23,5 +23,5 @@ module angularLocalStorageTests {
}
var app = angular.module('angularLocalStorageTests', ['angularLocalStorage']);
app.controller('testCtrl', ['$scope', 'storage', ($scope: TestScope, storage: AngularLocalStorageService) => new angularLocalStorageTests.TestController($scope, storage)]);
app.controller('testCtrl', ['$scope', 'storage', ($scope: TestScope, storage: ng.localStorage.ILocalStorageService) => new ng.LocalStorageTests.TestController($scope, storage)]);
+12 -10
View File
@@ -5,16 +5,18 @@
/// <reference path="../angularjs/angular.d.ts"/>
interface AngularLocalStorageService {
set(key: string, value: any): any;
get(key: string): any;
remove(key: string): boolean;
clearAll(): void;
declare module ng.localStorage {
interface ILocalStorageService {
set(key: string, value: any): any;
get(key: string): any;
remove(key: string): boolean;
clearAll(): void;
bind($scope: ng.IScope, key: string, opts?: {
defaultValue?: any;
storeName?: string;
}): any;
unbind($scope: ng.IScope, key: string, storeName?: string): void;
bind($scope: ng.IScope, key: string, opts?: {
defaultValue?: any;
storeName?: string;
}): any;
unbind($scope: ng.IScope, key: string, storeName?: string): void;
}
}