In Angular 4, I want to check for the current url and if it is equal to "/login" I need to submit a specific form. Here is the code:
let responseString=this.router.url;
console.log(responseString);
if (responseString.match("/login")==null)
this.submitForm();
The above code does not submit the form in all cases. There is something wrong with the if condition I guess. Any clues?
For simple string-to-string equality, you can use the ===
operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With