I've created a SHP 2013 Sharepoint-Hosted App on visual studio.
On my App.js that's created by default, i have the following lines to show a Modal Dialog
var options = { url: 'http://www.google.com', width: 400, height: 300 };
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
It works as intended, the little dialog is shown correctly.
After that, i've created a new Client Web Part (App Part) on visual studio, and on the aspx file for my app part i have the same JS lines
<script type="text/javascript">
var options = { url: 'http://www.google.com', width: 400, height: 300 };
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
</script>
But this time it returns an error saying the reference to the property 'execute' is null or undefined.
Is it possible to invoke a modal window from within a App Part? What changes from invoking it from the Default page of my app?
Thanks in advance.