Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Firebase+;Angularjs+;python_Javascript_Python_Model View Controller_Angularjs_Firebase - Fatal编程技术网

Javascript Firebase+;Angularjs+;python

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,

好的,我正在使用angularFire种子库来测试如何连接angularjs+firebase+python firebase库

我的目标是从python脚本向firebase添加内容,并将其显示在网页上

这是一个控制器:

    ......
    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,语法不那么混乱。你应该去看看