angularjs - Add content to transcluded content in angular directive -


I am trying to add content to embedded HTML inside my instruction. While this works visually, the console is giving me an error and I do not know how to fix it.

There is a planker showing this problem:

The line of app.js 39 is primarily what I am trying to do and is causing the error:

< Pre> children Prepended ('& lt; td & gt; & lt; input type = "checkbox" /> gt; & lt; / td & gt;');

In console output, this is:

  TypeError: Object 'nodeValue' can not be defined on ObjectInterpolateFnWatchAction [as fn] (https: / /code.angularjs.org/1.2.20/angular.js: 6913: 37) On Scope. Scope on $ digest (https://code.angularjs.org/1.2.20/angular.js:12447:29) $ Applied (https://code.angularjs.org/1.2.20/angular.js:12712:24) done (https://code.angularjs.org/1.2.20/angular.js:8315: 45) FullRoot At (https://code.angularjs.org/1.2.20/angular.js:8527:7) at XMLHttpRequest.xhr.onreadystatechange (https://code.angularjs.org/1.2.20/angular JS: 8466: 11)  

Thanks in advance!

I found out what was the problem posting in reply to someone here helps.

Basic code:

  var tbody = transclude (function (clone) {var children = clone child ('tr'), children Reuters ('ng-ripat', 'data in data'); Children. Prepended ('<' td> & lt; input type = "checkbox" /> gt; & lt; / td & gt; );}); $ Compilation (Tabs) ($ Scope. $ Parent, Function (Clone) {$ element.append (Clone);});  

Fixed code:

Instead of modifying the HTML inside of it, I used jquery to add html later Had to do

  var tbody = transclude (function (clone) {var children = clone.children ('tr'); children.attr ('ng-repeat', 'data in item');} ); Search for $ (tabs [1]) ('tr'). Prepaid ('& lt; td & gt; & lt; Input Type = "Checkbox" /> ;); $ Compilation (Tabs) ($ Scope. $ Parent, Function (Clone) {$ element.append (Clone);});  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -