Save generated XML view to file


In my nativescript angular app, I am generating a listview in a component like so:

 <ListView [items]="viewForSave" class="list-group">
            <template let-item="item" let-i="index">
                        <GridLayout rows="auto auto">
                            <Label  [text]="i+1" row="0" >
                            <Label text="" row = "1"></Label>
<Button text="Save View" (tap)="saveView()"> </Button>

the above view generates a list of items. I would like to save the elements displayed in this view as an XML/Html file in the file system. Would greatly appreciate any inputs on how I can go about this.