Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230172

How do we connect JavaScript file to ionic project

$
0
0

Hey guys, I am new to Ionic 4, after I created my first project, I followed the steps of the tutorial. And He deleted the project structure by building up a new HTML file and Javascript file to show it is still runnable. However, when I created exactly the same .js file as what he simply did at 1:37:00 in the video.

`
const usrnmInput = document.querySelector(’#input-usrnm’);
const pswrdInput = document.querySelector(’#input-pswrd’);
const signupBtn = document.querySelector(’#btn-signup’);
const loginBtn = document.querySelector(’#btn-login’);

loginBtn.addEventListener(‘click’, () => {
const enteredUsrnm = usrnmInput.value;
const enteredPswrd = pswrdInput.value;

if(
    enteredUsrnm.trim().length <= 0 || 
    enteredPswrd.trim().length <= 0
  ){
    return;
}
console.log(enteredUsrnm, enteredPswrd);

});` Then when I try to run in the chrome inspect tool, I couldn’t get the log message that wrote in this js file. and it pops me the error message that Uncaught ReferenceError: the document is not defined.
Do you guys know how could I fix this? I guess I shouldn’t create a Js file and should write it inside home.page.ts but I don’t know what it is and can’t start on it, and the tutorial didn’t cover much about it. Can someone please help me with this? Thank you so much!


Viewing all articles
Browse latest Browse all 230172

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>