2014-09-01 20 views
5

Tôi gặp phải lỗi này: Lỗi bắt buộc: [$ injector: unh] Nhà cung cấp không xác định: eProvider < - e sau khi triển khai thành công để Heroku

tôi đang sử dụng phần xã hội góc btw: https://github.com/djds4rce/angular-socialshare

tháo run chức năng và mô-đun tên djds4rce.angular-socialshare không gây ra lỗi nhưng tôi nặng cần phải có cho Fb chia sẻ.

//= require_self 
//= require_tree ./angular 

MyApp = angular.module("MyApp", ["ui.router", "ngCsv", "ui.bootstrap", "ngResource", "templates", "angularFileUpload", "ngSanitize", "ngCookies", "textAngular", "djds4rce.angular-socialshare"]).run(function($FB){ 
    $FB.init('1438666983087556'); 
}); 

Bất kỳ ý tưởng nào? Cảm ơn.

Trả lời

6

Rails minifies js, vì vậy bạn phải sử dụng một cú pháp khác nhau:

MyApp = angular.module("MyApp", ["ui.router", "ngCsv", "ui.bootstrap", "ngResource", "templates", "angularFileUpload", "ngSanitize", "ngCookies", "textAngular", "djds4rce.angular-socialshare"]); 

MyApp.run(['$FB', function($FB){ 
    $FB.init('1438666983087556'); 
}]); 
+0

Cảm ơn rất nhiều. Tôi sẽ giữ điều này trong đầu tôi @apneadiving –

2

Thats đúng tôi phải thay đổi tập tin coffescript tôi để

@HomeCtrl = ['$scope', '$location', ($scope, $location) -> 
    $scope.things = ['Angular', 'Rails 4.1', 'Working', 'Together!!'] 
] 

để làm cho nó làm việc. Hãy chú ý đến '$ scope', '$ location'

+0

Tại sao điều này lại cần thiết? Tại sao cú pháp này không hoạt động: 'angular.module ('App'). Controller" CommentsFormCtrl ", ($ scope, $ routeParams, $ http, CommentService) ->' – Kaspar

Các vấn đề liên quan