javascript - just one of the ng-bind-html in page work -
i write angularjs application , have block of code first html-bind-html works me
<div ng-bind-html='newstitle'> <div ng-bind-html='newsdetail'></div> </div>
when alter priority :
<div ng-bind-html='newsdetail'> <div ng-bind-html='newstitle'></div> </div>
it shows newsdetail value. how many ng-bind-html per page can declare? why sec value doesn't show?
i guess understand problem.
<div ng-bind-html='newstitle'> <!-- replace content of div $scope.newstitle --> <div ng-bind-html='newsdetail'> <!-- won't appear, because has been removed ng-bind-html='newstitle' --> </div> </div>
look comments in code. if set newsdetails in first place, binded html ($scope.newsdetail) replace current content aswell.
in word, ng-bind-html replace current content of element binded html provide. shouldn't set html in elements.
you have :
<div class="news"> <div ng-bind-html='newstitle'></div> <div ng-bind-html='newsdetail'></div> </div>
some docs ngbindhtml directive : https://docs.angularjs.org/api/ng/directive/ngbindhtml
javascript angularjs bind
No comments:
Post a Comment