小编Liz*_*ean的帖子

ng-repeat似乎不起作用

我试图从我的数组中提取所有名为'collections'的项目.当我在我的html中输入调用时,我只看到我页面上数组中第一项的完整代码.我试图只引入'edm.preview',这是该项目的图像.我正在使用Angular Firebase和一个叫做Europeana的api .我的应用程序允许用户搜索和选择他们喜欢的图像并将其保存到特定用户.

这是js:

  $scope.users = fbutil.syncArray('users');

  $scope.users.currentUser.collections = fbutil.syncArray('collections');
  $scope.addSomething = function (something) {
    var ref = fbutil.ref('users');
    ref.child($rootScope.currentUser.uid).child('collections').push(something);
  }
  $scope.addSomething = function(item) {
      if( newColItem ) {
        // push a message to the end of the array
        $scope.collections.$add(newColItem)
          // display any errors
          .catch(alert);
       }
    };
Run Code Online (Sandbox Code Playgroud)

和HTML:

<ul id="collections" ng-repeat="item in collections">
  <li ng-repeat="item in collections">{{item.edmPreview}}</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

angularjs ng-repeat europeana-api

3
推荐指数
1
解决办法
143
查看次数

angularFire无法$向firebase添加数据

我正在使用angularFire并尝试使用$ add将数据从表单保存到firebase.任何帮助将不胜感激.控制台记录所有工作,我能够在控制台中检索数据.对不起所有的代码...我想确保我提供了所需的所有材料.

app.js:

    var creativeBillingApp = angular.module('creativeBillingApp', ['ngRoute', 'firebase']);

    creativeBillingApp.constant('FIREBASE_URI', "https://XXXX.firebaseIO.com/");

    creativeBillingApp.controller('MainCtrl', ['$scope', 'groupsService', function( $scope,  groupsService, $firebase ) {

    console.log('Works')


    $scope.newGroup = {
     name: '',
     status: ''

    };

   $scope.addGroup = function(newGroup){

   console.log(newGroup);

groupsService.addGroup();
  $scope.newGroup = {
    name: '',
    status: ''

  };
};
 $scope.updateGroup = function (id) {
   groupsService.updateGroup(id);
 };

 $scope.removeGroup = function(id) {
   groupsService.removeGroup(id);
 };
}]);




creativeBillingApp.factory('groupsService', ['$firebase', 'FIREBASE_URI',
  function ($firebase, FIREBASE_URI) {
    'use strict';
    var ref = new Firebase(FIREBASE_URI);
    return $firebase(ref).$asArray();

var groups = $firebase(ref).$asArray();

var getGroups = …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs firebase angularfire

0
推荐指数
1
解决办法
493
查看次数