我用一些对象填充我的angularjs cookie,比如
$scope.benchmarks = function(product) {
$cookieStore.put("benchmark_prods", product);
$scope.benchmarks = $cookieStore.get("benchmark_prods");
console.log(benchmarks); //is getting filled
};如果cookies包含元素,我想访问视图,但我不知道如何访问
我试过了
<div ng-repeat="product in products">
//here the click event which is stroing product in cookie an simultanly shuld update cookie loop
<a data-placement="bottom" ng-click='benchmarks(product)' title="" rel="tooltip" class="button-icon jarviswidget-delete-btn" href="javascript:void(0);" data-original-title="Delete"><i class="fa fa-bookmark"></i></a>
</div>
<div ng-controller="MainCtrl">
<fieldset>
<section>
<div class="panel-heading">
<legend class="params">
<h4 class="panel-title">
Benchmarks
</h4>
</legend>
</div>
<div ng-repeat="benchmark_prod in benchmarks">
{{benchmark_prod}}
</div>
<div class="inline-group" id="conf_display">
</div>
</div>但不起作用
发布于 2014-07-06 00:10:04
$scope.benchmarks = function(product)
{
$cookieStore.put("benchmark_prods", product);
if($cookieStore.get("benchmark_prods")!=null && $cookieStore.get("benchmark_prods")!="")
{
$scope.benchmarkspro=$cookieStore.get("benchmark_prods")
}
console.log(benchmarkspro); //is getting filled
};在html中将基准测试改为基准测试。
https://stackoverflow.com/questions/24586982
复制相似问题