[英]Function was working, but now says it is not a function
I have a service that returns an array of states. 我有一个返回状态数组的服务。 It was working (thanks Sajeetharan), but now I'm getting a page error saying that it's not a function.
它正在工作(感谢Sajeetharan),但是现在我收到一个页面错误,说它不是一个函数。
constructor(
public navCtrl: NavController,
public navParams: NavParams,
private contactService: ContactsProvider,
private stateService: StatesProvider,
private auth: AuthenticationProvider) {
this.contactId = this.navParams.get('contactId');
}
ngOnInit(){
this.contactService.getContactById(this.contactId)
.subscribe(res => {
this.contact = res.json();
this.contactInitials = this.contact.first_name.charAt(0) + this.contact.last_name.charAt(0);
})
this.states = this.stateService.getStates();
}
The specific error is 具体错误是
: Error: Uncaught (in promise): TypeError: this.stateService.getStates is not a function
:错误:未捕获(承诺):TypeError:this.stateService.getStates不是函数
. 。
What could cause this? 是什么原因造成的?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.