Add radlistview programatically in Angular


I don’t see examples or an api for adding radlistview to a view programatically.

This sort of works, but I don’t see how to bind the data to the template. What would I use in place of ng-template and let-item=“item”?

let lv = new listviewModule.RadListView();
            lv.items = [1, 2, 3, 4, 5, 6.6];
            lv.selectionBehavior = "Press";
            lv.itemTemplate = "<Label [text]='item'></Label>";


May I know why you would want to do it programatically when templates are powerful and easier with Angular?


I am doing a drag and drop template and was going to use a radlistview if the screen size is smaller than 600 rather than drop zones.


Why don’t you just add a ngIf when you want to conditionally include the RadListView?


I’m trying it, but it does seem to me like there should be code behind way to build a radlistview in Angular. This thread shows it in Core:


Of course there should be a way, end of the day everything is complied to JavaScript and RadListView or any component is built with JavaScript.

My point is that you don’t have to struggle writing long JS code when your HTML can be dynamic unlike NativeScript core.