typescript 打字稿+角度1的启动片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript 打字稿+角度1的启动片段相关的知识,希望对你有一定的参考价值。

/// <reference path="../../include.ts" />
"use strict";
module STEN.Services {


    export interface IService {
        
        Method();
    }

    export class Service implements IService {
        
        static $inject: Array<string> = ["$http"];
        constructor(public $http: ng.IHttpService) {

        }
        public Method() {
           }
    }
}
// main
/// <reference path="./app/app-init.ts" />


// typings
/// <reference path="../../typings/angularjs/angular.d.ts" />


// services
/// <reference path="./services/Service.ts" />
/// <reference path="../../include.ts" />

module APP.Controllers {
    'use strict';
   
    import Services = STEN.Services.Account;
  
    export class Ctrl {
      
        static $inject: Array<string> = ["Service"];
        constructor(public service: Services.IService) {
          
        }

        public Method() {
         
        }


}

    var app = APP.Init.getApp([...commonDependancies]);
    app
        .service("Service", Services.Service)
        .controller('Ctrl', Ctrl)
}
/// <reference path="../include.ts" />
var commonDependancies = ["..."];
var apiPath = "http://localhost:8080";

module APP.Init {
    export var getApp: (dependancies: Array<string>) => ng.IModule = (dependancies) => {
        var app = angular.module("APP", dependancies);
        
        return app;
    }
}

以上是关于typescript 打字稿+角度1的启动片段的主要内容,如果未能解决你的问题,请参考以下文章

角度是不是已被打字稿取代? [关闭]

带有打字稿的嵌套角度指令

如何检查打字稿+角度中的变量类型?

如何在具有角度注入参数的打字稿中创建新对象

如何使用带有角度依赖注入的打字稿继承

在打字稿中创建指令以显示角度加载进度