Unable to open modal popup using nativescript


#1

this is the error thrown:
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIAlertController: 0x16bc5600>)

code snippets:

import { alert } from "ui/dialogs";
item.component.ts
 displayAlertDialog() {
    let options = {
        title: "Race selection",
        message: "Race chosen: Unicorn",
        okButtonText: "OK"
    };
       alert(options).then(() => {
        console.log("Race chosen!");
    });
}

Am i missing any package to import

Please suggest


#2

May I know when exactly you are calling displayAlertDialog()?


#3

item.component.html

<StackLayout class="p-15"sdkExampleTitle sdkToggleNavButton>
        <Button text="Display Alert Dialog" (tap)="displayAlertDialog()" class="btn btn-primary btn-active" ></Button>
    </StackLayout>
    

#6

added page-router-outlet in app component but its not working


#7

modal popup is working now after adding navigation properly