我的问题是,每次选择标记更改时,ProductContooller.js.coffee中的值$ scope.variationValue都是未定义的。知道为什么它的undefine?
ProductContoller.js.coffee
controllers = angular.module('controllers')
controllers.controller("ProductController", [ '$scope', '$routeParams', '$location','Restangular'
($scope,$routeParams,$location,Restangular)->
$scope.update_variation = ()->
console.log $scope.variationValue <---- undefined why?
Restangular.one('products', $routeParams.id).get().then (c) ->
$scope.price = c.cheapest_variant.price
$scope.product = c
return
])
product.html.slim
.form-group
label for="sel1" Variations:
select ng-options="variant as variant.opt1_value for variant in product.variants" ng-model="variationValue" ng-change="update_variation()"
| Value {{variationValue.price}}