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

8 angularjs typescript angular-ui-router

我正在使用带有ui-router的打字稿.有没有人为此找到任何打字稿定义.我看着肯定打字,什么都看不见.这是我想要找到的接口文件:

$stateProvider
Run Code Online (Sandbox Code Playgroud)

Rad*_*ler 17

我们使用这个d.tsui-router:

更新的链接,2015年5月

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月)版本时,我也遇到了很少的构建问题.解决方案简而言之就是

  • 角度定义被转换
    • 从: declare module ng {
    • 成: declare module angular {
  • 所以更新angular.d.ts最新版本
  • 更新了所有相关的(现有的) d.ts,以及(角animate.d.ts,角sanitize.d.ts ...)
  • 更改所有其他(custom)模块声明
    • declare module ng.XXX {
    • declare module angular.XXX {

通过以下几个步骤...所有应该再次工作 (原始,不工作的链接)

资源的小代码片段形式:

// 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 {
    ...
Run Code Online (Sandbox Code Playgroud)

用法示例

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