< p>When I try to list the clickable list of Person, it doesn’t work.
export class PersonComponent {
persons = MYPERSONS;
selectedPersons = Person;
onSelect(person: Person): void {
this.selectedPerson = person; // here is the error on "this.selectedPerson"
}
}
const MYPERSONS: Person[] = [
{id:0, firstName:'First', lastName:'Firstly', creationData: 1},
{id :1, firstName:'Second', lastName:'Test', creationData:10},
{id:2, firstName:'Third', lastName:'Candidate', creationData:5}
] ;
export class Person {
id: number;
firstName: string;
lastName: string;
creationData: any;
}
I received the following error:
Type’Person’ is not assignable to type’typeof Person’.
Property’prototype ‘is missing in type’Person’.
What does this mean? I can’t find this error on the Internet. Due to my lack of experience, this may be anything I can’t see on the code
selectedPersons = Person;
You are assigning the variable selectedPersons to the class Person Reference to the default value. What you might intend to do is to specify that the selectedPersons class attribute will contain instances of the Person class. You can do this:
selectedPersons:Person;
div>
I want to use Angular2 to write a web application on Webstorm. I am very good at doing this. I am trying out the tutorial on the angular website Angular.IO.
When I try to list the clickable list of Person, it doesn’t work.
export class PersonComponent {
persons = MYPERSONS;
selectedPersons = Person ;
onSelect(person: Person): void {
this.selectedPerson = person; // here is the error on "this.selectedPerson"
}
}
const MYPERSONS: Person[] = [
{id:0, firstName:'First', lastName:'Firstly', creationData: 1},
{id:1 , firstName:'Second', lastName:'Test', creationData:10},
{id:2, firstName:'Third', lastName:'Candidate', creationData:5}
];< br />
export class Person {
id: number;
firstName: string;
lastName: string;
creationData: any;
}
I received the following error:
< blockquote>
Type’Person’ is not assignable to type’typeof Person’.
Property’prototype’ is missing in type’Person’.
What does this mean? I can’t find this error on the internet. Due to my lack of experience, this may be anything I can’t see on the code
When you do Write:
selectedPersons = Person;
You are assigning the variable selectedPersons the default value of the class Person reference. What you might intend to do is specify The selectedPersons class attribute will contain instances of the Person class. You can do this:
selectedPersons:Person;
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2498 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC