各位好,由于鄙人js基础较差,在工程中遇到基础问题较多,尤其是“万物皆对象”这个理念。就比如:1、scope.dataArr=;我要为其增加属性,scope.dataArr.currTopic=xxxx就是错误的;然而$scope.dataArr[currTopic]是正确的。2、scope.dataArr中有一个key名为currTopic,初始value为[]。我要为currTopic的value增加值,即想push元素到[]中去。使用scope.dataArr.currTopic.push( xxx ) 又是错误的。$scope.dataArr[currTopic].push( xxx ) 是正确的。这是为什么?
添加回答
举报
0/150
提交
取消