Mawrene
Mawrene

Reputation: 35

customize alert box angularjs

I have a login form I make a test if the username & password invalid I want showed in sweet alert

this is my code :

 else {
          alert('login & password invalid')
          var path = "index.html";
          window.location.href = path;
         }

this is link of my plunker : link plunker

Upvotes: 0

Views: 1140

Answers (2)

Jerhemy
Jerhemy

Reputation: 590

Sounds like you want a modal popup for which there are many different options.

Look at ngDialog.

You can create a custom HTML template that will display your login alert window, then in your code call

else {
    ngDialog.open({
        template: 'externalTemplate.html',
        controller: 'SomeController'
    });
}

Upvotes: 1

Adrian Higgins
Adrian Higgins

Reputation: 84

My opinion, it's easier just to make a div that has an absolute positioning in the center of the screen, make the size, colors, words whatever you want. Make the display invisible.

Then, add a JS event listener to make it visible whenever you need it to be. I built a web phone app where the editing forms were positioned overlapped of the main project in the center of the screen, made visible/invisible by events.

Also, don't forget to add box-shadow ;)

Upvotes: 1

Related Questions