有没有为AngularJS UI路由器的打字稿定义? [英] Are there any Typescript definitions for the AngularJS ui-router?

查看:159
本文介绍了有没有为AngularJS UI路由器的打字稿定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用与UI路由器打字稿。有没有人发现这方面的任何打字稿定义。我看着就肯定类型的,什么也看不见。这是我想找到一个接口文件的内容:

  $ stateProvider


解决方案

我们正在使用此的 d.ts 的为 UI路由器

更新的链接,月 - 2015年

<一个href=\"https://github.com/borisyankov/DefinitelyTyped/blob/master/angular-ui-router/angular-ui-router.d.ts\" rel=\"nofollow\">https://github.com/borisyankov/DefinitelyTyped/blob/master/angular-ui-router/angular-ui-router.d.ts

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

<一个href=\"https://raw.githubusercontent.com/borisyankov/DefinitelyTyped/master/angular-ui-router/angular-ui-router.d.ts\" rel=\"nofollow\">https://raw.githubusercontent.com/borisyankov/DefinitelyTyped/master/angular-ui-router/angular-ui-router.d.ts

升级说明:

当我更新角-UI-router.d.ts 到最新版本(2015年5月)的版本,我也面临着一些问题构建。简而言之溶液


  

      
  • 角定义转变
      

        从
    • 声明模块纳克{

    •   
    • 申报模块的角度{

    •   

  •   
  • 所以更新的 angular.d.ts 最新版本

  •   
  • 更新所有相关的(现有的) d.ts 以及(角animate.d.ts,角sanitize方法。 d.ts ...)

  •   
  • 更改其他(自定义)模块类似的声明
      

        
    • 声明模块ng.XXX {

    •   
    • 声明模块angular.XXX {

    •   

  •   

通过这几个步骤......都应该可以正常工作了
,不工作的链接)

小code片段形式的资源:

对角JS

  //类型定义1.1.5+(ui.router模块)
//项目:https://github.com/angular-ui/ui-router
//定义是:米歇尔Salib&LT; HTTPS://github.com/michelsalib>
//定义:https://github.com/borisyankov/DefinitelyTyped///&lt;参考路径=../ angularjs / angular.d.ts/&GT;声明模块ng.ui {    接口即将状态置{
    ...

使用的例子

 模块MyModule的
{
    出口类MyStateConfig
    {
        构造函数(私人$ stateProvider:ng.ui.IStateProvider
            私人$ urlRouterProvider:ng.ui.IUrlRouterProvider
            ...)
        {
            这一点。$ stateProvider.state(...

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

解决方案

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

Updated link, May - 2015

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

raw version (ready for copy/paste)

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

UPGRADE Notes:

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

  • angular definition was converted
    • from: declare module ng {
    • into: declare module angular {
  • so update angular.d.ts to the latest version
  • updated all related (existing) d.ts as well (angular-animate.d.ts, angular-sanitize.d.ts...)
  • change all other (custom) modules declarations like
    • declare module ng.XXX { into
    • declare module angular.XXX {

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

small code snippet form that resources:

// 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 {
    ...

The example of usage

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

这篇关于有没有为AngularJS UI路由器的打字稿定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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