未知提供者:dataProvider

时间:2017-12-02 18:54:36

标签: angularjs

我使用以下代码,'firebaseDetailCtrl'在页面上抛出错误:

  

错误:[$ injector:unpr]未知提供者:dataProvider< - data< -   firebaseDetailCtrl

我不是专家,我知道还有其他解释,但我找不到合理的解决方案和一些帮助。

'use strict';

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

myApp.controller("todoCtrl", function($scope, $firebaseObject) {
  var ref = firebase.database().ref();

  // download the data into a local object
  $scope.data = $firebaseObject(ref);
});

myApp.controller('firebaseDetailCtrl', ['$scope', '$routeParams', 'data',
  function($scope, $routeParams, data) {
    $scope.url = $routeParams.id; 

    $scope.todoWork2 = data.query();
  }]);


myApp.config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/projects/:id', {
      templateUrl: 'partials/firebase-details.html',
      controller: 'firebaseDetailCtrl'
    }).
    when('/projects', {
    templateUrl: 'partials/firebase-items.html',
    controller: 'todoCtrl'
  }).
      otherwise({
        redirectTo: '/projects'
      });
  }]);

0 个答案:

没有答案