javascript - Angular view template content updates only on mouse over -


i have strange behavior using angular template controller . special view content updates on mouse on only. have setup few jsfiddles cannot reproduce problem. mistake in source code. special thing see here use $scope method format , display html content. {{order.total()}} € weird work sometimes.

all other html parts updating expected. idea wrong?

enter image description here

$scope.order = {    _total : 0,    total : function() {      return globalize.format(this._total, "n");    },    positions: []  };      $scope.addproducttocurrentorder = function(packageindex, productid) {      var rs = {      _id : productid    };        var tab = $scope.categories[packageindex].packages;    (var = 0; < tab.length; i++) {      var pack = tab[i];      if (pack.productid === productid){        pack.quantity++;        rs.articlename = pack.name;        rs.price = pack.price;        rs._price = pack._price;        rs.unit = pack.unit;        rs.weight = pack.weight;        break;      }    }    $scope.order.positions.push(rs);    $scope.order._total += rs._price;  };
<h1>    <span class="btn btn-default btn-large">{{order.total()}} €</span>  </h1>    <div data-id="{{package.productid}}" class="btn bt-default panel panel-default order order-card withripple" ng-click="addproducttocurrentorder($parent.$index, package.productid)">    	<div class="panel-body">      	<p class="lead">  {{package.name}}</p>       	<p>{{package.weight}} {{package.unit}}</p>        	</div>  	<div class="ripple-wrapper"></div>  </div>

there might no reason expression not working, instead

  • remove globalize function call, see going on globalize.
  • compute globalize string when recomputing new total.
  • use of filter() angular expression compute globalization.

what library behind ?

mock globalize function

var globalize = {   format : function(a,b) {      return 22;      } }; 

http://jsfiddle.net/darul75/5l2d9y75/


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -