Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change "src" attribute value of ng-include in angularJS after first load?

On a keyboard event I want to change the ng-include directive's src value dynamically.

like image 354
D.S Avatar asked Jun 13 '13 17:06

D.S


1 Answers

Here is a code example that could help you:

<div class="example-animate-container" ng-include="{{template.url}}">

Then in directive or controller

$(document).on("keydown", function () {
    template.url = "put the value here";
    $scope.$apply();
});
like image 80
Ajay Beniwal Avatar answered Oct 11 '22 13:10

Ajay Beniwal