且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AngularJS ui-router 是否有任何 Typescript 定义?

更新时间:2023-01-25 23:04:27

我们将这个 d.ts 用于 ui-router:

We are using this d.ts for ui-router:

更新链接,2015 年 5 月

Updated link, May - 2015

https://github.com/borisyankov/DefinitelyTyped/blob/master/angular-ui-router/angular-ui-router.d.ts

原始版本(准备复制/粘贴)

https://raw.githubusercontent.com/borisyankov/DefinitelyTyped/master/angular-ui-router/angular-ui-router.d.ts

升级注意事项:

当我将 angular-ui-router.d.ts 更新到最新(2015 年 5 月)版本时,我也遇到了一些构建问题.简而言之,解决方案是

When I updated angular-ui-router.d.ts to the latest (May 2015) version, I also faced few build issues. Solution in a nutshell was

  • 角度定义被转换
    • 来自:declare module ng {
    • 进入:声明模块角度{
    • 将模块 ng.XXX { 声明为
    • 声明模块angular.XXX {

    通过这几个步骤......一切都应该重新工作(原创, 无效链接)

    With these few steps... all should be working again (original, not working link)

    该资源的小代码片段:

    // Type definitions for Angular JS 1.1.5+ (ui.router module)
    // Project: https://github.com/angular-ui/ui-router
    // Definitions by: Michel Salib <https://github.com/michelsalib>
    // Definitions: https://github.com/borisyankov/DefinitelyTyped
    
    /// <reference path="../angularjs/angular.d.ts" />
    
    declare module ng.ui {
    
        interface IState {
        ...
    

    用法示例

    module MyModule
    {
        export class MyStateConfig
        {
            constructor(private $stateProvider: ng.ui.IStateProvider
                , private $urlRouterProvider: ng.ui.IUrlRouterProvider
                ...)
            {
                this.$stateProvider.state(...