incuna / angular-bind-html-compile Goto Github PK
View Code? Open in Web Editor NEWDirective that calls $compile on trusted HTML, allowing directives in an API response.
License: MIT License
Directive that calls $compile on trusted HTML, allowing directives in an API response.
License: MIT License
First, thanks to all who have worked on this directive! I works like a charm.
I need to use this in a recursive manner. I am building a table from several data sets and would like to use bind-html-compile in both the 'root' html form, but also in the created forms created by the function serviced by the directive. As an example the 'buildRow' function calls 'buildDetail', each of which requires angular data binding
index.html:
buildRow = function() {
return "{{fooBar}}
}
buildDetail = function() {
return "
Hi,
I am getting this digestion error using this directive
[$rootScope:infdig] http://errors.angularjs.org/1.3.8/$rootScope/infdig
The $compile in the directive does not work on iOS cordova app, and prevents the HTML from getting rendered at all.
I faced an issue related to not destroying the scope related to the elements implementing new directives.
I think that i can make a plunkr about that but as basis when you have a directive inside the markup compiled and you change whole html text directive will be created again and will not be destroyed properly.
Related PR: #27
If this is a case that only happens some of the time, then why does the code always call the - toString - method? And if - value - is "falsey" (e.g. an empty string, 0, null, etc.) then it will be passed to the - html - method (which sets the innerHTML property of the element)?
The intent of the code is just not clear. For example, what is allowed for the - value - argument? For another, what is supposed to happen if it is a disallowed value (e.g. assume that setting the innerHTML property to "null" is not intended). The comment isn't helping either; if anything, it makes the intent less clear.
// In case value is a TrustedValueHolderType, sometimes it
// needs to be explicitly called into a string in order to
// get the HTML string.
element.html(value && value.toString());
This repo currently has no tests and no code style.
grunt-jscs
and grunt-contrib-jshint
packages.jshintrc
and .jscs
code style files (see other incuna repos)grunt test
task to run the above two taskstravis.yml
file to install and run grunt test
as part of pull requestsPlease submit your code to npmjs.org as "angular-bind-html-compile"
Simply do:
mkdir angular-bind-html-compile
cd angular-bind-html-compile
npm init
# work your magic…
npm publish
I would do it but don't want to take credit for all of your work. 👍
In order to manage $watch and other angular scope stuff on bind html compile call, is it possible to add calling scope as function argument ?
Hey, nice job on this, btw. It's been incredibly helpful.
How do I pass in my own scope variable? I know it's in the bindHtmlScope attr, but how do I use it? Basically I have a child scope I created, but I'm not sure how to pass it into this directive so it lands in the bindHtmlScope variable.
Thanks
I tried to install your package through bower on a platform with a recent angular, it was impossible due to the requirement of angular ~1.2 in this project's bower.json. Why such an outdated requirement?
Found this thing in my current project and couldn't help but wonder why the window object was referenced. Just pass a reference to the global - angular - variable. Better yet, just reference it as it is a global. The window object shouldn't enter into it.
would be nice to use with bind once.
When using on or inside an element with ngRepeat, this can trigger the following error:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
My use case for this directive (displaying editable templates) requires the use of a specific isolate scope when compiling the template.
Since it's extra functionality that does not (I hope) affect the current functionality, I made a PR for it (#2).
Like most components usually do, it would be nice to have an up-to-date minified version bundled into angular-bind-html-compile.
Hi guys,
Thanks for the good job you did!
Can you extend the directive to support template-url="myUrlValue"
, it will be really useful!
Thanks in advance!
Hello,
at first I have to say that this directive really helped me during my project!
But at the moment I am trying to realize two bindings on the same page, the only problem I have with this is, that each time I change the content of one of them, both will compile and therefore a ng-repeat repeats a second time, which is not applicable for my case.
Is there any workaround for this scenario?
I could imagine a second directive with a boolean value where you can dynamically change if the binding has to be compiled or not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.