Javascript 为什么说这个错误?:错误:[$compile:nonassign]表达式';未定义'。。。是不可转让的!AngularJS 1.5
我正在尝试创建一个组件,用于在我自己的网站中创建“Tweets”,当我尝试在textarea中写入内容时(无法写入任何内容) 我有一张显示错误的图片: 这是我在“editorTweets.component.js”中的代码: 以及.html视图:Javascript 为什么说这个错误?:错误:[$compile:nonassign]表达式';未定义'。。。是不可转让的!AngularJS 1.5,javascript,node.js,angularjs,Javascript,Node.js,Angularjs,我正在尝试创建一个组件,用于在我自己的网站中创建“Tweets”,当我尝试在textarea中写入内容时(无法写入任何内容) 我有一张显示错误的图片: 这是我在“editorTweets.component.js”中的代码: 以及.html视图: <div class="container-editor-tweets"> <div class="left-editor-tweets"> <img ng
<div class="container-editor-tweets">
<div class="left-editor-tweets">
<img ng-src="{{$ctrl.currentUser.image}}" alt="Img-User"/>
</div>
<div class="right-editor-tweets">
<div class="editor-tweet-body">
<textarea name="tweet_msg" id="tweet_msg" placeholder="Whats going on?..." ng-model="$ctrl.tweet.body"></textarea>
</div>
<div class="editor-tweet-options">
<button class="btn-submit-tweet" type="button" ng-click="$ctrl.submit()">Tweet</button>
</div>
</div>
</div>
推特
组件不应该有绑定,因为我不需要发送任何数据,所以组件试图获取“tweet”,这就是错误所在
这是正确的代码:
let EditorTweets = {
controller: EditorTweetsComponentCtrl,
templateUrl: 'components/tweets-helpers/editorTweets.html'
};
您是否尝试过将tweet附加到作用域而不是像
scope:{'tweet':'='}
let EditorTweets = {
controller: EditorTweetsComponentCtrl,
templateUrl: 'components/tweets-helpers/editorTweets.html'
};