离子2:提供的参数与呼叫目标的任何签名都不匹配

时间:2016-11-15 12:49:17

标签: angular firebase ionic-framework ionic2

当我尝试使用

构建我的应用时,我收到了错误消息
  

离子运行android

这是错误

> data_output
# A tibble: 12 × 4
   month     EWR     JFK     LGA
   <dbl>   <dbl>   <dbl>   <dbl>
1      1 39.3725 39.0875 38.9150
2      2 42.1625 39.3425 42.9050
3      3 37.4150 36.7775 37.3025
4      4 50.1275 48.1550 49.2050
5      5 58.8725 55.7150 59.1575
6      6 70.7825 70.2950 71.5700
7      7 86.9900 85.1225 87.2000
8      8 69.2075 69.0725 69.9425
9      9 60.6350 61.2125 61.7375
10    10 59.8850 58.3850 60.5150
11    11 45.7475 45.1700 49.0700
12    12 32.4950 38.0975 34.0325

我添加了course-page.ts组件

[14:38:19]  lint finished in 1.88 s
[14:38:33]  Error: Error at
            C:/Users/adirz/myapps/studentAssistantApp/.tmp/pages/courses-page/courses-page.ngfactory.ts:943:29
[14:38:33]  Supplied parameters do not match any signature of call target.

我还添加了课程数据提供者

 import { Component } from '@angular/core';
import {NavController, LoadingController,AlertController,NavParams} from 'ionic-angular';


//import providers
import {CoursesData} from "../../providers/Courses-data";
import firebase from 'firebase';

/*
  Generated class for the CoursesPage page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  selector: 'page-courses-page',
  templateUrl: 'courses-page.html'
})
export class CoursesPage {
  public pet: string = 'SemA';
  public coursesA: Array<any> = [];
  public coursesB: Array<any> = [];
  public department:any;
  public gaming: string = 'all';
  public courseNames: Array<any> = [];
  constructor(public navCtrl: NavController,private navParams:NavParams,private loadingCtrl: LoadingController,public coursesData:CoursesData,public alertCtrl: AlertController) 
  {
    console.log("adir");
      this.department=this.navParams.get('department');
      console.log(this.department.id);

  }

  ionViewDidLoad() {
   let loader = this.loadingCtrl.create({});

    this.coursesA=this.coursesData.getCoursesList(this.department.id);
    if(this.coursesA){
      console.log("hello world");
      console.log(this.coursesA);
       loader.dismiss();

    }
     //this.coursesData.getCourse(this.department.id)ף

    /*this.getCoursesList().then((x: Array<any>) => {

      if (x) {
        this.coursesA = x;
        this.courseNames = x;
        loader.dismiss();
      }

    }); 
    */

  }

我想这是我在course-data.ts import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import 'rxjs/add/operator/map'; import firebase from 'firebase' /* Generated class for the CoursesData provider. See https://angular.io/docs/ts/latest/guide/dependency-injection.html for more info on providers and Angular 2 DI. */ @Injectable() export class CoursesData { //firebase datab public fireRef:any; public coursesList:any; public coursesA: Array<any> = []; constructor() { this.fireRef=firebase.database().ref(); this.coursesList=firebase.database().ref('Courses/'); } public getCourse(departmentId:any):any{ var semesterRef = firebase.database().ref('Courses/'+departmentId+'/SemA'); return semesterRef; /*semesterRef.on('child_added', function(courseSnapshot) { console.log(courseSnapshot.key); courseSnapshot.forEach(function(childSnapshot):boolean{ return courseSnapshot.val(); // to appease TypeScript }); }); */ } public getCoursesList(departmentId:any):any { var rootRef = firebase.database().ref('Courses/'+departmentId+'/SemA'); var listChild =[]; rootRef.on('child_added', function (childData) { childData.forEach(function(childData2){ listChild.push(childData2.val()); return false; }) }); return(listChild); } }

中从函数返回的东西

我认为我做错了。

当我运行离子服务时,它工作正常。

1 个答案:

答案 0 :(得分:0)

我通过更改这里的函数参数解决了这个问题。我用标记引用标记了参数?意味着没有必要通过它们。

C:/Users/adirz/myapps/studentAssistantApp/.tmp/pages/courses-page/courses-page.ngfactory.ts:943:29