angularjs - Angular directive watch not updating -



angularjs - Angular directive watch not updating -

html of view

<div class="container-fluid" ng-controller="searchcontroller search"> <pretty-print displayfilecontents="search.displayfilecontents"></pretty-print> </div>

directive setup

app.directive("prettyprint", function() { return{ restrict: "e", scope: { displayfilecontents: "=" }, template: '<pre id="code" class="prettyprint linenums">{{displayfilecontents}}</pre>', link: function(scope, element, attrs) { scope.$watch("displayfilecontents", function () { element.html(scope.displayfilecontents); prettyprint(); },true); }} })

for reason watch on "displayfilecontents" comes undefined scope.displayfilecontents

search.displayfilecontents has value in searchcontroller...i can print html in view , outputs code, want phone call prettyprint() 1 time gets loaded.

angularjs angularjs-directive angularjs-scope

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -