Comments (6)
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.
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.
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.
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.
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.
Sounds good for me. Thank you !
from ng-notify.
Related Issues (20)
- Callback after notify fadeout HOT 2
- Testing with protractor - change $timeout to $interval HOT 1
- How to call a scope function ? HOT 4
- Conflict? with angular-underscore after build HOT 2
- Html button event HOT 1
- how can i stop dismiss() when hover status? HOT 1
- No Button Visisble HOT 1
- integrate with form validation? HOT 1
- ngNotify circular reference error when accessing in http interceptor HOT 5
- Occures TypeError when trying to dismiss a notiication. HOT 1
- Close button with sticky true
- Publish v0.8.0 to npm HOT 2
- callback execution
- version on npm package
- Uncaught SyntaxError: Unexpected token . in ng-notify.min.css
- Issue on iOS HOT 1
- Allow users to close a notification even if it's not sticky? HOT 1
- ngSanitize issue HOT 1
- Is ng-notify unmaintained? HOT 1
- angular SnotifyModule Show template error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-notify.