I have 2 templates :
<body ng-app="tutorialWebApp">
<!--HEADER-->
<div ng-include='"openclick/templates/header.html"'></div>
</br></br></br></br></br></br>
<!--PARTIAL CONTENIDO -->
<div ng-view></div>
<!--FOOTER-->
</br><div ng-include='"openclick/templates/footer.html"'></div>
</body>
i want to execute a jquery action in the ng-view .I have this in my WHEN angular config.
.when("/", {templateUrl: "openclick/partials/home.html", controller: "PageCtrl"})
And in HOME.HTML I have this button :
<!--Content angular ng-include-->
<button id="btn1">Append text</button>
The jquery script I want to execute is :
$("button").click(function(){
$("p").append("<b>Appended text</b>");
});
but It doenst work , it has to be added as this Jquery event .
$(document).on("click", "#btn1", function() {
$("p").append(" <b>Appended text</b>.");
});
and but I also can do this : appending this to the angular controller.
app.controller('PageCtrl', function () {
$("#btn1").click(function(){
$("p").append(" <b>Appended text</b>.");
});
$("#btn2").click(function(){
$("ol").append("<li>Appended item</li>");
});
but im not sure which or if it is the correct uses for integrate jquery with angular template or include?
` tag, and a click event bound to a function that changes that value. then you'll just have to output that property into the `
` in your template.
– Kevin B Feb 04 '15 at 19:07