How to do a URL validation with AngularJS [closed]

0

I'm working on a project .. however I need to do a validation by taking the current url .. Ex:

If(url('https://pt.stackoverflow.com/questions/ask')){
    // Aqui vem minha lógica
}

How do I do this with AngularJS ('am I a beginner in angular ..')?

Thank you.

    
asked by anonymous 19.09.2017 / 16:53

1 answer

1

You can and should do this using JavaScript.

Just use window.location.href .

It will return the URL you are currently in.

This way you can do:

if(window.location.href == 'www.google.com'){
    //Sua lógica aqui
}

For more information about window.location, see here .

    
19.09.2017 / 17:07