AngularJS ui-router 是否有任何 Typescript 定义? [英] Are there any Typescript definitions for the AngularJS ui-router?

查看:19
本文介绍了AngularJS ui-router 是否有任何 Typescript 定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using typescript with ui-router. Has anyone found any Typescript definitions for this. I looked on definately typed and could see nothing. Here is what I would like to find an interface file for:

$stateProvider

推荐答案

我们将这个 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(...
    

    这篇关于AngularJS ui-router 是否有任何 Typescript 定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆