我有以下代码:
//put this inside viewDidLoad (or wherever you create your Table)
if !NSUserDefaults.standardUserDefaults().boolForKey("FirstTimeLauched") {
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "FirstTimeLauched")
NSUserDefaults.standardUserDefaults().synchronize()
create() // do your table creating code here.
}
当我执行它时,Chrome总是抱怨:
// Get combination prices
var combID = $('#idCombination').val();
var combinationsFromController;
var combination = combinationsFromController[combID];
if (typeof combination === 'undefined')
return;
// Set product (not the combination) base price
var basePriceWithoutTax = +productPriceTaxExcluded;
var basePriceWithTax = +productPriceTaxIncluded;
var priceWithGroupReductionWithoutTax = 0;
任何人都可以帮助我,为什么会这样?
我试过了:
combinationsFromController is not defined.
没有运气。
答案 0 :(得分:0)
您从未定义过控制器的组合。
var combinationsFromController;
// combinationsFromController is undefined because you did not give it a value
您必须先为变量赋值,然后才能使用它们。
你可能想要
var combinationsFromController = getCombitationsFromController()
将getCombitationsFromController()
替换为代码以从控制器获取组合。