I have a html
<div id="doc1"></div>
after that I add add new html inside id "doc1"
document.getElementById("doc1").innerHTML = '<div id="doc2">{{ value }}</div>';
accurately there should be
<div id="doc1"><div id="doc2">{{ value }}</div></div>
but {{ value }} not working to bind
this my JS code
(function () {
angular
.module('myApp')
.controller('MyController', myController);
function myController($scope){
Initial();
function Initial(){
document.getElementById("doc1").innerHTML = "<div id="doc2">{{ value }}</div>";
$scope.value = "Hi There";
}
}
}) ();
document.getElementById()and.innerHTMLhave nothing to do in an Angular app. It is out of "Angular's world". Selecting elements by ID and adding text to them is not how Angular works.