Heroku上部署的Angular + rails ...大括号显示,实际上并没有提取数据

时间:2014-08-11 09:09:41

标签: ruby-on-rails angularjs heroku

我在Heroku上部署了一个在rails上使用Angular.JS的应用程序。当我在本地打开它时它会起作用,但在Heroku上,{{}}括号不会提取数据,而只是显示为{{}}(例如{{name.Title}}而不是通过行动获取标题)。我怎样才能解决这个问题?

应用程序本身非常简单,rails没有数据库,没有,只有一个角度页面从公共API获取信息并显示它。

这是我的代码:  应用程序/资产/ Javascript角/控制器/ mainindexCtrl.js.coffee

@IndexCtrl = ($scope, $http)->

  $scope.movieList = null
  $scope.bigDisplay = null
  $scope.submitInput = (movie) ->

    $http(method: "GET", url: "http://www.omdbapi.com/", params: {s: movie}

    ).success((data, status, headers, config) ->
      $scope.movieList = data.Search
    ).error (data, status, headers, config) ->

  $scope.movieInfoGet = (movie) ->
    index = $scope.movieList.indexOf(movie)
    $http(method: "GET", url: "http://www.omdbapi.com/", params: {t: movie.Title}

    ).success((data, status, headers, config) ->
      $scope.movieList[index].Details = data

    ).error (data, status, headers, config) ->
      console.log "error "

  $scope.bigDisplayGet = (movie) ->

    $http(method: "GET", url: "http://www.omdbapi.com/", params: {t: movie.Title}

    ).success((data, status, headers, config) ->
      $scope.bigDisplay = data
    ).error (data, status, headers, config) ->

应用程序/视图/ index.html.erb:

  <div data-ng-controller="IndexCtrl">
    <div class="col-md-4">
      <form data-ng-submit="submitInput(searchInput); hideOrNot=true">
        <input class="search" type="search" data-ng-model="searchInput">
      </form>
      <div data-ng-repeat="name in movieList">
        <h4 data-ng-click="hideOrNot = !hideOrNot; movieInfoGet(name); bigDisplayGet(name)">{{name.Title}}</h4>
          <ul data-ng-hide="hideOrNot">
            <!-- <li><img src={{name.Details.Poster}}></li> -->
            <li>year: {{name.Details.Year}}</li>
            <li>imdb: {{name.Details.Rated}}</li>
            <li>released: {{name.Details.Released}}</li>
          </ul>
      </div>
    </div>
    <div class="col-md-8">
      <ul>
        <li>{{bigDisplay.Title}}</li>
        <li><img src={{bigDisplay.Poster}}></li>
      </ul>


      <h3>big space</h3>
    </div>

  </div>
<!-- </div> -->

我第一次登录页面时收到的错误:

Error: [$injector:unpr] Unknown provider: tProvider <- t
http://errors.angularjs.org/1.2.21/$injector/unpr?p0=tProvider%20%3C-%20t
    at http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:5205
    at http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:21648
    at Object.n [as get] (http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:20909)
    at http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:21743
    at n (http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:20909)
    at r (http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:21194)
at Object.i [as instantiate] (http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:21338)
at http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:5:5594
    at http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:30928
    at o (http://murmuring-dusk-6700.herokuapp.com/assets/application-abaefe0f7bf3e04087fe7ffcbdb9b278.js:4:5648) 

1 个答案:

答案 0 :(得分:0)

通常角度未正确初始化。在浏览器的控制台中,您是否看到错误?在网络选项卡中,是否所有资源都已加载?