我开始使用 Firebase (AngularFire) 为我的应用程序同步数据。它是 Scrum 的卡片工具,可将卡片添加到数组中。您可以操作输入字段。
首先,我使用了 localStorage,效果非常好。现在我基本实现了 Firebase,我遇到了以下问题:在一个字段中键入一个键后,应用程序停止,恢复键入的唯一方法是再次单击输入字段。
你知道这是为什么吗?非常感谢您!
这是我在Controller中的基本实现:
Card = (@color, @customer, @points, @number, @projectName, @story) ->
$scope.cards = []
reference = new Firebase("https://MYACCOUNT.firebaseio.com/list")
angularFire(reference, $scope, "cards")
$scope.reset = ->
$scope.cards = []
$scope.addCardRed = (customer) ->
$scope.cards.push new Card("red", customer)
那是我的标记:
<div class="card card-{{ card.color }}">
<header>
<input class="points" contenteditable ng-model="card.points"></input>
<input class="number" placeholder="#" contenteditable ng-model="card.number"></input>
<input class="customerName" contenteditable ng-model="card.customer.name"></input>
<input class="projectName" placeholder="Projekt" contenteditable ng-model="card.projectName"></input>
</header>
<article>
<input class="task" placeholder="Titel" contenteditable ng-model="card.task"></input>
<textarea class="story" placeholder="Story" contenteditable ng-model="card.story"></textarea>
</article>
<footer>
<div class="divisions">
<p class="division"></p>
<button ng-click="deleteCard()" class="delete">X</button>
</div>
</footer>
</div>
<div class="card card-{{ card.color }} backside">
<article>
<h2 class="requirement">Requirements</h2>
<textarea class="requirements" placeholder="Aspects" contenteditable ng-model="card.requirements"></textarea>
</article>
</div>