angularjs - How to access Angular attribute via Javascript injection -
for instance, let's have
<div class="row costbreakdown__shipping"> <div class="small-8 medium-7 large-7 columns">shipping:</div> <div class="small-4 medium-5 large-5 columns text-right" ng-switch="cart.israted"> <!-- ngswitchwhen: true --><div ng-switch-when="true" class="ng-binding ng-scope">$8.48</div><!-- end ngswitchwhen: --> <!-- ngswitchwhen: false --> </div> </div> how 1 access value $8.48 in class costbreakdown__shipping? i've have
var x = $(".costbreakdown__shipping").eq(2).children().eq(1).children().eq(1) which gives me
<!-- ngswitchwhen: true --><div ng-switch-when="true" class="ng-binding ng-scope">$8.48</div>
but how go accessing value inside?
have tried using .innerhtml @ end of assignment value x?
var x = $(".costbreakdown__shipping").eq(2).children().eq(1).children().eq(1).innerhtml if using angular, why not assign variable , declare in "shipping" controller (or whatever controller you're using)
<div ng-switch-when="true" class="ng-binding ng-scope">{{shippingcost}}</div> and in controller, can declare
$scope.shippingcost = '$8.48'; or try shipping cost = 8.48 , apply filter currency on shippingcost in html
Comments
Post a Comment