Giter VIP home page Giter VIP logo

Comments (6)

matowens avatar matowens commented on August 28, 2024

Hey there @NetanelBasal, as far as I understand, I believe binding html content here would require an additional dependency - ng-sanitize if I remember correctly. My initial thoughts have been to keep this super lean and simple, and allow others to modify when needed to fit their particular needs. I think it might be best to leave that bit out of this module and allow those that would like to add it to their specific projects do so via a fork.

Just my thoughts, how does that sound? Are you aware of another way to do something like this without requiring an additional module be included?

Would others prefer to bind html and require the sanitize module here or would most prefer to keep it lean and simple with the ability to make any tweaks they'd like on their own?

from ng-notify.

NetanelBasal avatar NetanelBasal commented on August 28, 2024

Most of the cases the developer will set the message, not the client, so i does not think its really danger ,You can do this is with innerHTML and let the user consider if he want to use it, just put an option like html:true or something, cause this is important than we be able to insert there things like links and extra..

from ng-notify.

gaetancollaud avatar gaetancollaud commented on August 28, 2024

Hi,

I think html content would be a great idea too.

ngSanitize is indeed the best solution to implement this.

Like @NetanelBasal suggested, I think the best way to display HTML messages is to have an option when we use set(). Lke this, we don't alter your current API, we just add something.

ngNotify.set('<b>Error</b> : you are wrong', {
    type: 'error',
    html:true
});

from ng-notify.

matowens avatar matowens commented on August 28, 2024

Hey there @gaetancollaud, my hesitation with adding ngSantize directly to the ngNotify module is that anyone who currently uses this and pulled down the latest update would have breaking changes introduced if they didn't also include ngSanitize.

I played around a little bit with this, too, and have added in a check for the ngSanitize script. If it exists, we dynamically inject it, and if it doesn't exist, we gracefully degrade back to using HTML escaped messages. The use would be the same as in your example, setting the 'html' attribute to true. If you set 'html' to true and ngSanitize doesn't exist, we shoot out a debug message in the console reminding the developer and continue using escaped HTML messages.

This should continue to work the same way for those that are already using it as well as give the added option for HTML notifications for those who decide to include ngSanitize in their app. Let me know what you guys think.

I'm going to run it through a few more tests when I can dig up some free time but it looks like it's going to work out.

from ng-notify.

matowens avatar matowens commented on August 28, 2024

Just ran through tests and pushed an update, v0.6.0.

https://github.com/matowens/ng-notify/blob/master/CHANGELOG.md

Thanks guys!

from ng-notify.

gaetancollaud avatar gaetancollaud commented on August 28, 2024

Sounds good for me. Thank you !

from ng-notify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.