I want to add the DOM elements to a page on click of a button, i have written the code of the things to be added in a new html file called "newmission.html" as shown below.
<div class="boxheader" ng-controller="edit_vision_missionCtrl">
<div style="float:right; clear:right; width:20%;">
<span><a href="" style="" ng-click="deletemission(mission.id)"><img src="assets/img/delete.png" style="width: 20%; height: 20%;"></a></span>
</div>
<span style="font-size: large; font-family: monospace; font-weight: bold;">EDIT MISSION NAME</span><input type="text" value="Enter Mission Name" class="form-control" style="background-color: #e8e8e8">
</div>
<div style="padding-top: 10px;">
<span style="font-size: large; font-family: monospace; font-weight: bold; margin-left:5%;">EDIT MISSION POINTS</span><br />
</div>
<div style="padding-top: 10px;">
<ul style="float: left; width: 100%;">
<li style="padding: 2px; width: 100%;">
<div style="float:right; clear:right; width:20%;">
<span><a href="" style=""><img src="assets/img/delete.png" style="width: 20%; height: 20%;"></a></span>
</div>
<div>
<input type="text" value="Enter Mission Point" class="form-control" style="background-color: #e8e8e8; width: 80%;">
</div>
</li>
</ul>
</div>
<div style="padding-top: 35px;">
<a href=""><img id="addmissionpoint" src="assets/img/add.png" alt="addmission" style="width: 7%;height: 12%;float: right; bottom: 0;"></a>
</div>
I am calling a function "addmission" which is in the controller, that adds the above html file contents in a div having id "toappend" but it is not working. I am using JQuery to add this, but angularJS or Javascript solutions will also be helpful. the function in the controller is shown below.
var newid = 0;
$scope.addmission = function(){
newid--;
$.get("newmission.html", function(data) {
$("#toappend").prepend(data);
});
};
This is the code from where i am calling the function.
<div style="padding-top: 35px;">
<a href="" ng-click="addmission()"><img id="addmission" src="assets/img/add.png" alt="addmission" style="width: 7%;height: 12%;float: right; bottom: 0;"></a>
</div>
ng-click="addmission()"somewhere in html. Probably here:<a href="" ng-click="addmission()"><img id="addmissionpoint" …