Property does not exist on type


#1

import {Component, Input} from ‘@angular/core’;

export class Accordion {

groups: Array = [];

constructor() {
}

closeOthers(openGroup: AccordionGroup): void {
this.groups.forEach((group: AccordionGroup) => {
if (group !== openGroup) {
group.isOpen = false;
}
});
}
}

@Component({
selector: ‘accordion-group’,
template: ‘collapse-item.html’
})
export class AccordionGroup{

private _isOpen:boolean = false;

@Input() heading: string;

@Input()
set isOpen(value: boolean) {
this._isOpen = value;
if (value) {
this.accordion.closeOthers(this);
}
}

Property accordion does not exist on type accordion group

how can i fix this?


#2

declare accordition type like this: public accordition: any;


#3

I’m experiencing the same error but through this:

 createPlace(placeName: string, placeAddress: string, placeType: string,placeDescription: string) {
  this.placesData.createPlace(this.userProfile.uid,
  placeName,placeAddress.toUpperCase(), placeType, placeDescription , pointlat, pointlng).then( () => {
  this.nav.pop();
});
}

ERROR:

[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:773:40
[16:48:57] Property ‘placeName’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:785:41
[16:48:57] Property ‘placeAddress’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:798:41
[16:48:57] Property ‘placeType’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:832:41
[16:48:57] Property ‘placeDescription’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1064:43
[16:48:57] Property ‘placeName’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1069:43
[16:48:57] Property ‘placeAddress’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1074:43
[16:48:57] Property ‘placeType’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1089:43
[16:48:57] Property ‘placeDescription’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1094:67
[16:48:57] Property ‘placeName’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1094:90
[16:48:57] Property ‘placeAddress’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1094:116
[16:48:57] Property ‘placeType’ does not exist on type ‘AddplacePage’.
[16:48:57] Error at C:/Users/treva/Documents/Apps/SampleApp/.tmp/pages/addplace/addplace.ngfactory.ts:1094:139
[16:48:57] Property ‘placeDescription’ does not exist on type ‘AddplacePage’.


#4

Are you sure your error is resulting from the function you pasted, and not from the template?


#5

This error is emitted from the fact that you’re in ([ngModel]) fits into the property, but do not use it…Looking on your ([ngModel]) blocks


#6

Yes, I am, I was using those exact same lines of code (With corresponding HTML) in ionic beta 11. Migrated. I didn’t see why I was getting that error from those lines of code. (I’m still facing the problem)


#7

I’m still skeptical. I suspect the errors are in the template, and perhaps related to private properties in the component.


#8

Wow,… that worked… umm…

So I did this:

export class EventCreatePage {
  eventName: string;
   eventDate: string;
   eventPrice: number; 
  eventCost: number;

  constructor(public nav: NavController, public eventData: EventData) {
    this.nav = nav;
    this.eventData = eventData;
  }

  createEvent(eventName: string, eventDate: string, eventPrice: number, eventCost: number) {
    this.eventData.createEvent(eventName, eventDate, eventPrice, eventCost).then( () => {
      this.nav.pop();
    });
  }

}

Why do I have to declare the arguments?.. It… doesn’t make any sense… but okay…

Is it because I use [(ngModel)] in html?


#9

Yes. If they’re not publicly accessible properties of the component, you can’t reference them in the template.


#10

Interesting… thank you