Basic angularFire options: $save, $add and $remove.

The way connect firebase:

var app = angular.module('app', ['firebase']);
    var ref = new Firebase(FIREBASE_URI);
//create an item storage
var items = $firebase(ref);

Example:

<!DOCTYPE html>
<html ng-app="app">
<head lang="en">
<meta charset="UTF-8">
<title>Angular Firebase</title>
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> </head>
<body ng-controller="MainCtrl">
<table class="table edit">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Count</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(id, item) in items">
<td><input type="text" ng-model="item.name" ng-blur="updateItem(id)"/></td>
<td><input type="text" ng-model="item.description" ng-blur="updateItem(id)"/></td>
<td><input type="text" ng-model="item.count" ng-blur="updateItem(id)"/></td>
<td>
<a href="#" ng-click="removeItem(id)" class="navbar-link">Remove</a>
</td>
</tr>
</tbody>
</table> <div class="well">
<h4>Add Item</h4> <form class="form-inline" role="form" novalidate ng-submit="addItem()">
<div class="form-group">
<input type="text" class="form-control" ng-model="newItem.name" placeholder="Name">
</div>
<div class="form-group">
<input type="text" class="form-control" ng-model="newItem.description" placeholder="Description">
</div>
<div class="form-group">
<input type="text" class="form-control" ng-model="newItem.count" placeholder="Count">
</div>
<button type="submit" class="btn btn-default">Add</button>
</form>
</div> <script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.6.0/angularfire.js"></script>
<script src="public/js/app.js"></script>
</body>
</html>
/**
* Created by Answer1215 on 11/9/2014.
*/ var app = angular.module('app', ['firebase']); app.constant('FIREBASE_URI', 'https://<your_app>.firebaseio.com/'); app.controller('MainCtrl', ['$scope', 'ItemsService', function ($scope, ItemsService) {
$scope.newItem = { name: '', description: '', count: 0 };
$scope.currentItem = null; $scope.items = ItemsService.getItems(); $scope.addItem = function () {
ItemsService.addItem(angular.copy($scope.newItem));
$scope.newItem = { name: '', description: '', count: 0 };
}; $scope.updateItem = function (id) {
ItemsService.updateItem(id);
}; $scope.removeItem = function (id) {
ItemsService.removeItem(id);
};
}]); app.factory('ItemsService', ['$firebase', 'FIREBASE_URI', function ($firebase, FIREBASE_URI) {
var ref = new Firebase(FIREBASE_URI);
var items = $firebase(ref); var getItems = function () {
return items;
}; var addItem = function (item) {
items.$add(item);
}; var updateItem = function (id) {
items.$save(id);
}; var removeItem = function (id) {
items.$remove(id);
}; return {
getItems: getItems,
addItem: addItem,
updateItem: updateItem,
removeItem: removeItem
}
}]);

Also take a look the Forge, The easy way you can go to your app's forage is copy paste the FIREBASE_URI into boswer.

In Forge, you can modify, remove or add the data. Also you can import JSON format data into the Forage, all those things happen in real time.

[Firebase] 1. AngularFire, $save, $add and $remove, Forge的更多相关文章

  1. eclipse tomcat add and remove工程异常

    1  eclipse导入工程后,右击server add and remove工程时,there are no resource: 解决方案:右击工程->单击property->选择pro ...

  2. eclipse中tomcat使用add and remove无法发布web项目

    继上次启动eclipse中的tomcat报classNotFound的问题后,这次又遇到新问题.就是右键点击tomcat使用add and remove发布web项目至tomcat后,启动tomcat ...

  3. [置顶] 有关ListIterator接口的add与remove方法探究

    ListIterator接口继承自Iterator接口,新增了add()等方法. 关于ListIterator的add()方法的作用(接口是没有方法实现的,但其实现类对于add()方法的实现机制大致相 ...

  4. Arrays.asList 为什么不能 add 或者 remove 而 ArrayList 可以

    分析如下例子: 1 import java.util.Arrays; 2 import java.util.List; 3 4 5 public class Test { 6 public stati ...

  5. eclipse中tomcat的add and Remove找不到项目

    在我们运行项目前,都需要将项目部署到tomcat上,但是有时我们会遇到这种情况:项目明明存在,但是eclipse中tomcat的add and remove找不到项目,无法部署,那么这个问题该如何解决 ...

  6. 数组转换为List(Arrays.asList)后add或remove出现UnsupportedOperationException

    Java中,可以使用Arrays.asList(T... a)方法来把一个数组转换为List,返回一个受指定数组支持的固定大小(注意是固定大小)的列表.此方法同 Collection.toArray( ...

  7. 【java】在分页查询结果中对最后的结果集List进行操作add()或remove()操作,报错:java.lang.UnsupportedOperationException

    场景: 在分页查询结果中对最后的结果集List进行操作add()或remove()操作,报错:java.lang.UnsupportedOperationException 错误: java.lang ...

  8. Arrays.asList()后调用add,remove这些method时出现java.lang.UnsupportedOperationException异常

    String[] queryNames = request.getParameterValues("queryName"); List<String> queryNam ...

  9. 为什么Java里的Arrays.asList不能用add和remove方法?

    在平时的开发过程中,我们知道能够将一个Array的对象转化为List.这种操作,我们仅仅要採用Arrays.asList这种方法即可了.笔者前段时间一直用这种方法,有一天,我发现通过Arrays.as ...

随机推荐

  1. 洛谷P4782 【模板】2-SAT问题 [2-SAT]

    题目传送门 [模板]2-SAT问题 题目背景 2-SAT 问题 模板 题目描述 有n个布尔变量 $x_1/~x_n$​ ,另有$m$个需要满足的条件,每个条件的形式都是“ $x_i$ 为$true/f ...

  2. 洛谷P2571 [SCOI2010]传送带 [三分]

    题目传送门 传送带 题目描述 在一个2维平面上有两条传送带,每一条传送带可以看成是一条线段.两条传送带分别为线段AB和线段CD.lxhgww在AB上的移动速度为P,在CD上的移动速度为Q,在平面上的移 ...

  3. Python并发编程-守护进程

    守护进程 子进程转换为守护进程 主进程的代码结束,子进程的代码也应该接收, 这个事情有守护进程来做 守护进程会随着主进程的代码执行完毕而结束, 而不是随着主进程的接收而结束(子进程不一定结束) fro ...

  4. TensorFlow——module 'tensorflow' has no attribute 'xxx'

    tf.sub()更改为tf.subtract() tf.mul()更改为tf.multiply() tf.types.float32更改为tf.float32 tf.pact()更改为tf.stact ...

  5. Linux_x86_Pwn溢出漏洞

    基础栈溢出:未开启任何保护的程序 漏洞程序源码 #include <stdio.h>#include <stdlib.h>#include <unistd.h>​v ...

  6. AM335x开发板与PC机虚拟机建立tftp文件传输

    1.AM335x开发板必须要支持以太网,而且在U-boot中要有完好的以太网驱动 因为开发板的储存介质为SD卡,所以在编译好的U-boot中并没有配置网络环境,为了不使每次上电都修改u-boot的网络 ...

  7. 小数据池,bytes

    '''python2 python3 '''#python2#print() print 'abc'#range() xrange() 生成器# raw_input() #python3#print( ...

  8. FastReport.Net使用:[32]对话框使用2

    方法/步骤 1.先浏览下数据,成绩表中有部分科目成绩没有,如果是这种情况,报表是不能打印的. 2.添加一个对话框,将其Visible属性设置为False,默认情况下改对话框是不显示的. 将确定按钮的D ...

  9. PowerBuilder连接数据库

    什么是PowerBuilder(后面简称PB)? 这是个奇怪的问题,说实话,在这次毕业设计之前,我也不知道什么是PowerBulider(当然,不排除我见识短浅).百度百科是这样解释的:"P ...

  10. 【20181030T1】排列树【树形结构+组合数】

    题面 [正解] 一眼找规律 --**这东西有啥规律啊 哎好像根节点是最小的 好像可以组合数分配子树大小,子树内部-- 可以递归啊! 乱搞一顿就好啦 过了大样例 复杂度\(O(N)\) 切完T2后T3水 ...