打字稿不编译AngularFire获取“asArray”代码

时间:2015-11-26 17:50:54

标签: javascript typescript firebase angularfire angular

Typescript没有编译AngularFire获取“asArray”代码。

我想要的结果是在控制台中没有AngularFire签名错误的情况下编译打字稿。

只是为了澄清,我的代码有效但是typescript编译器包含1个错误。

似乎AngularFire与typescript编译器不兼容。

这是我的代码(我在问题所在地发表评论):

   import {Component, View, bootstrap, bind, provide} from 'angular2/angular2';
   import {Router, ROUTER_BINDINGS, RouterOutlet, RouteConfig, RouterLink, ROUTER_PROVIDERS, APP_BASE_HREF} from 'angular2/router';
   import {Injectable} from 'angular2/angular2';
   import {HTTP_PROVIDERS, Http, Headers} from 'angular2/http';

   import {Todo} from './components/todo/todo';
   import {AuthService} from './authService';
   import {EnvironmentService} from './environmentService';

   import {AngularFire, FirebaseArray} from '../firebase/angularfire';

   @Component({
       selector: 'app'
   })

   @View({
       template: `
           <div class="container">
               <nav>
                   <ul>                 
                       <li><a (click)="getAllProfiles()">Get all profile</a></li>       
                   </ul>
               </nav>
               <router-outlet></router-outlet>
           </div>
       `,
       directives: [RouterOutlet, RouterLink]
   })

   @RouteConfig([
       { path: '/', redirectTo: '/home' },
       { path: '/home', component: Todo, as: 'Home' }
   ])

   @Injectable()
   export class AppComponent {
       listOfProfiles:FirebaseArray;
       data: AngularFire;

       constructor(){
       }

       //Error Here - This works but has typescript signature error:    
       public getAllProfiles(){
           this.data = new AngularFire(new        Firebase('https://markng2.firebaseio.com/profiles'));
           this.listOfProfiles = this.data.asArray();       

           console.log(this.listOfProfiles.list);
       }
   }

   bootstrap(AppComponent, [ROUTER_PROVIDERS, provide(APP_BASE_HREF, {useValue: '/'}), HTTP_PROVIDERS, AuthService, EnvironmentService]);

以下是打字稿编译器错误的屏幕截图(最后一条消息):

enter image description here

提前致谢。

0 个答案:

没有答案