Javascript Firebase+;Angularjs+;python
好的,我正在使用angularFire种子库来测试如何连接angularjs+firebase+python firebase库 我的目标是从python脚本向firebase添加内容,并将其显示在网页上 这是一个控制器:Javascript Firebase+;Angularjs+;python,javascript,python,model-view-controller,angularjs,firebase,Javascript,Python,Model View Controller,Angularjs,Firebase,好的,我正在使用angularFire种子库来测试如何连接angularjs+firebase+python firebase库 我的目标是从python脚本向firebase添加内容,并将其显示在网页上 这是一个控制器: ...... angular.module('myApp.controllers', []) .controller('MyCtrl1', ['$scope', 'FBURL', 'angularFire', function($scope,
......
angular.module('myApp.controllers', [])
.controller('MyCtrl1', ['$scope', 'FBURL', 'angularFire', function($scope,
FBURL, angularFire) {
angularFire(FBURL+'/syncedValue', $scope, 'syncedValue', '');
}])
......
......
angular.module('myApp.controllers', [])
.controller('MyCtrl1', ['$scope', 'FBURL', 'angularFire', function($scope,
FBURL, angularFire) {
angularFire(FBURL+'/syncedValue/1', $scope, 'syncedValue', '');
}])
......
这是一种观点:
......
<h4>{{syncedValue}}</h4>
<input ng-model="syncedValue" type="text" />
......
使子对象成为syncedValue的:
r = f.push({"syncedValue": "3433"})
这会使孩子具有uid:
但我只想更新syncedValue键的值,而不添加任何子项,就像这样
用angularjs说点什么我不明白。我明白了
from firebase import Firebase
f = Firebase("https://xxxxx.firebaseio.com/syncedValue")
r = f.update({"syncedValue": "3433"})**strong text**
该代码更新syncedValue的子级
所以
我只是在控制器中创建了一个孩子:
......
angular.module('myApp.controllers', [])
.controller('MyCtrl1', ['$scope', 'FBURL', 'angularFire', function($scope,
FBURL, angularFire) {
angularFire(FBURL+'/syncedValue', $scope, 'syncedValue', '');
}])
......
......
angular.module('myApp.controllers', [])
.controller('MyCtrl1', ['$scope', 'FBURL', 'angularFire', function($scope,
FBURL, angularFire) {
angularFire(FBURL+'/syncedValue/1', $scope, 'syncedValue', '');
}])
......
Python中有一个非常简单的库,可用于使用Firebase,语法不那么混乱。你应该去看看