草庐IT

properties_container

全部标签

javascript - Angular2 - 类型错误 : Cannot read property 'Id' of undefined in (Typescript)

我收到以下错误:angular2.dev.js:23925EXCEPTION:TypeError:Cannotreadproperty'Id'ofnullin[{{product.Id}}inProductEditComponent@0:68]抛出://Product-edit.component.ts:import{Component}from'angular2/core';import{IProduct}from'./product'import{ProductService}from'./product.service'import{RouteParams}from'angula

javascript - react - 类型错误 : Cannot read property 'props' of undefined

我正在尝试创建一个能够删除列表中项目的点击事件,但是当我点击它时,我得到“类型错误:无法读取未定义的属性‘props’”。我尽量坚持使用ES6,而且我很确定在某处绑定(bind)“this”是一件好事,但我尝试了很多地方但都没有成功。importReact,{Component}from'react';import'./App.css';classAppextendsComponent{render(){return();}}classStreetFighterextendsComponent{constructor(props){super(props);this.state={ch

javascript - 导入 anuglar2/forms 导致 "Cannot read property ' 未定义注释”

我正在尝试创建简单的表单,如http://angularjs.blogspot.no/2015/03/forms-in-angular-2.html中所述,但是当我添加从'angular2/forms'导入{forms,required};在崩溃中TypeError:Cannotreadproperty'annotations'ofundefinedTypeError:Cannotreadproperty'annotations'ofundefinedatReflectionCapabilities.System.register.execute.$__export.annotatio

javascript - promise - TypeError : Cannot read property 'then' of undefined

我想我只需要另一双眼睛看这个,因为我无法得到我在这里缺少的东西。$scope.checkout=function(form){//somecodeherefunctioncheckoutErrorHandler(error){//somecodehere}functiondisplaySuccessMessage(){$scope.success=true;cartService.emptyCart();}checkoutService.makePayment($scope.payment).then(function(i){//somecodeherecheckoutService.

javascript - 开 Jest + 火力地堡 : TypeError: Cannot read property 'defineProperties' of undefined

我目前正在做一个ReactNative项目,想使用FirebaseJSSDK。为了熟悉它的所有API,我想用Jest编写一些学习测试。这是我的测试:importFirebasefrom'firebase';describe('Firebase',function(){it('shouldwork',function() {expect(null).toBeNull()})});不幸的是我收到了这个错误:●测试套件运行失败TypeError:Cannotreadproperty'defineProperties'ofundefinedatnode_modules/firebase/app

javascript - {...object, property : value} work with spread syntax? 如何

在查看ES6文档时,我注意到建议使用扩展语法而不是更冗长的Object.assign()方法。但是,我对这是如何实现的有点困惑。在这种情况下object是否被分解为key:value对,之后添加或覆盖逗号右侧的属性,最后被重新组装? 最佳答案 Isobjectinthiscasebeingbrokendowntokey:valuepairs,afterwhichthepropertyontherightofthecommaiseitheraddedoroverwritten,andfinallybeingreassembled?原始

javascript - Vuex + VueJS : Passing computed property to child is undefined

我正在阅读这个documentationonVuecomponents,但使用Vuex数据作为我的组件属性。在这个例子中,如果country_id在data方法中,它工作正常。但是当country_id是一个从Vuexstore返回数据的计算属性时,子组件的internalValue总是被初始化为undefined。我做错了什么?父组件:exportdefault{computed:{country_id(){returnthis.$store.state.user.country_id}},mounted:function(){this.$store.dispatch('user/l

javascript - Vue.js : "TypeError: Cannot set property props of#<Object> which has only a getter"

我正在尝试实例化一个Vue组件,但出现错误:[Vuewarn]:Errorinrender:"TypeError:Cannotsetpropertypropsof#whichhasonlyagetter"(foundin)我也在使用库vuedraggable但我认为这个问题更多的是Vue问题而不是vuedraggable问题。下面是我的代码。这里是draggable-list.vue可拖动列表.jsconstdraggable=require("vuedraggable");module.exports={name:"draggable-list",components:{dragga

javascript - 执行 Action 时 redux 出错 : Uncaught type error: cannot read property 'type' of undefined

刚刚接触React。我想这是一个基本问题,但我不明白为什么reducer没有被解雇或更新状态:我的HomeView.js:....const{localeChange,counter,locale}=this.propsreturn(increment(7)}>Increment.....)constmapStateToProps=(state)=>({locale:state.locale,counter:state.counter})exportdefaultconnect(mapStateToProps,{localeChange,increment})(HomeView)我的r

javascript - 将 message.properties 暴露给 javascript?

有没有一种简单的方法可以将所有已翻译的字符串公开给javascript?我希望能够在我的JS文件中使用翻译后的字符串,而无需在GSP中手动构建它们。有没有简单的方法来做到这一点? 最佳答案 Jawr插件(用于优化JS和CSS资源的好插件)可以将部分或全部i18n消息包暴露给Javascript:http://jawr.java.net/docs/messages_gen.html 关于javascript-将message.properties暴露给javascript?,我们在Stac