This should be simple question while as a newbie I don't know what's the root cause.
Component definition:
@Component({
selector: 'app-angular-demo-web-part',
templateUrl: './angular-demo-web-part.component.html',
styleUrls: ['./angular-demo-web-part.component.scss'],
encapsulation: ViewEncapsulation.Emulated
})
export class AngularDemoWebPartComponent implements OnInit {
@Input() description: string;
@Input() _Myitems: any[];//=[{text:"A",value:1},{text:"B",value:2},{text:"C",value:3}];
@Input() testdescription: string;
constructor() { }
singleRootTree: Node<Folder> = mockTree;
ngOnInit() {
}
}
Template:
<p>
It works! Description: {{description}}
<br />
testdescription: {{testdescription}}
<br/>
array:{{_Myitems}}
<treetable [tree]="singleRootTree"></treetable>
</p>
<div id="navigation" class="DemoA">
<div class="DemoB">
<ul>
<li *ngFor="let item of _Myitems">
{{ item.text }}
</li>
</ul>
</div>
</div>
Render angular
public render(): void {
this.domElement.innerHTML = `<app-angular-demo-web-part description="${ this.properties.description }" testdescription="asasasa" [_Myitems]="[{text:"A1",value:1},{text:"B1",value:2},{text:"C1",value:3}]"></app-angular-demo-web-part>`;
}
But the array don't show anything, if I set the value in component directly, the data will show.
Result:
It works! Description: AngularDemo testdescription: asasasa array: