简体   繁体   English

Angular JS 级联通知

[英]Angular JS cascade notifications

I need your advice to help me.我需要你的建议来帮助我。

I'm making an Angular JS app and I need some notifications like angular-toastr or angular-ui-notification but showing not like a list but cascade.我正在制作一个 Angular JS 应用程序,我需要一些通知,如angular-toastrangular-ui-notification但显示的不是列表而是级联。 Like in picture bellow.如下图所示。

在此处输入图片说明

Can anybody help with advice or realization such kind of notifications?任何人都可以帮助提供建议或实现此类通知吗?

So I think what you want to do is divide and conquer this problem: Think about the UI as a set of components.所以我认为你想要做的是分而治之这个问题:将 UI 视为一组组件。 For the picture above, you might have the following.对于上面的图片,您可能有以下内容。

// Notification Cascacder applies DOM transformations to a list of 
<notification-cascader>
      // Iterates over a list of notifications
      <notification-list>
             // Contains primary DOM for a notification
             // accepts a variety of arguments for opacity, notification-message, etc. 
            <notification-card> </notification-card>
      </notification-list>
</notification-cascader>

Now that you've broken it up you can determine what the API for each component may be, write the tests and then code the component.现在您已经分解了它,您可以确定每个组件的 API 可能是什么,编写测试,然后对组件进行编码。 Writing it in this way will increase the reusability of each of the angular components.以这种方式编写它会增加每个角度组件的可重用性。 You could use a single notification-card without its parent in parts of the application.您可以在应用程序的某些部分使用一个没有其父级的通知卡。 Although it isn't angularjs related you can read this and apply the concepts https://reactjs.org/docs/thinking-in-react.html尽管它与 angularjs 无关,但您可以阅读此内容并应用这些概念https://reactjs.org/docs/thinking-in-react.html

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

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