骨干.js和/或敲除.js中的AngularJS示例 [英] AngularJS example in backbone.js and/or knockout.js

查看:86
本文介绍了骨干.js和/或敲除.js中的AngularJS示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在比较这些框架,以便在客户端进行一些计算.我真的很喜欢 AngularJS 网站上的示例.我想知道网站上是否有任何ribs.js或knockout.js专家会在各自的框架中重新创建该示例.

I'm comparing these frameworks to do some calculations on the client side. I really liked the example on the AngularJS site. I was wondering if any of the backbone.js or knockout.js experts on the site would please recreate that example in their respective frameworks.

这是 JSFiddle .

小提琴密码:

<table ng:init="invoice= {items:[{qty:10, description:'gadget', cost:9.95}]}">
  <tr>
    <th>Qty</th>
    <th>Description</th>
    <th>Cost</th>
    <th>Total</th>
    <th></th>
  </tr>
  <tr ng:repeat="item in invoice.items">
    <td><input name="item.qty" value="1" size="4" ng:required ng:validate="integer"></td>
    <td><input name="item.description"></td>
    <td><input name="item.cost" value="0.00" ng:required ng:validate="number" size="6"></td>
    <td>{{item.qty * item.cost | currency}}</td>
    <td>[<a href ng:click="invoice.items.$remove(item)">X</a>]</td>
  </tr>
  <tr>
    <td><a href ng:click="invoice.items.$add()">add item</a></td>
    <td></td>
    <th>Total:</th>
    <td>{{invoice.items.$sum('qty*cost') | currency}}</td>
  </tr>
</table>

<!-- 
  Workaround for jsfiddle to pass in ng:autobind
  http://doc.jsfiddle.net/basic/introduction.html#css
-->
<script src="http://code.angularjs.org/angular-0.9.10.min.js" ng:autobind></script>

<style>
table th {
  font-weight: bold;
}
table td {
  padding: 0.3em;
}

推荐答案

在这里您可以使用淘汰赛>>

Here you go for knockoutjs >

http://jsfiddle.net/neebz/YbwzJ/

我可能会有偏见,但它比棱角/骨干结构要复杂得多.

I might be biased but it's a lot more structural than angular/backbone.

如果您有任何疑问,请告诉我.

If you have any questions, let me know.

有些NaN支票我认为您可以接受.

There are some NaN checks which I think you could take yourself.

这篇关于骨干.js和/或敲除.js中的AngularJS示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆