简体   繁体   English

自定义警报框angularjs

[英]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 这是我的朋克的链接链接朋克

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. 我认为,只需要在屏幕中心绝对定位一个div,使其大小,颜色,文字随心所欲就容易了。 Make the display invisible. 使显示不可见。

Then, add a JS event listener to make it visible whenever you need it to be. 然后,添加一个JS事件侦听器以使其在需要时可见。 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 ;) 另外,别忘了添加box-shadow;)

Sounds like you want a modal popup for which there are many different options. 听起来好像您想要模态弹出窗口,该弹出窗口有许多不同的选项。

Look at ngDialog . ngDialog

You can create a custom HTML template that will display your login alert window, then in your code call 您可以创建一个自定义HTML模板,该模板将显示您的登录警报窗口,然后在您的代码调用中

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM