I have one proto object in angular dart I am taking values from proto object into dart object but I am unable to iterate it into html. How can I achieve this thing into dart like we do in angular?
Var obj=[{name:”test”}];
Html:
{{obj[0][‘name’]}}
I have tried to create object like:
List<Map<String,String>> details;
details= [{‘name’:’test’}];
Html:
{{details[0][‘name’]}}
But I am getting error ‘the getter is not defined for the class’.
Try the following code below:
Dart file:
List<Fields> fields = [
Fields("Jess", 10),
Fields("Sujuta", 11),
];
class Fields {
final String name;
final int age;
const Fields(this.objectName, this.age);
}
HTML file:
<div *ngFor="let field of fields">{{field.name}}</div>