2017-02-04 11 views
0

私の問題の解決策を探そうとしましたが、私のコードはうまくいくはずです。私はfirebaseからデータを取得し、それを私のビューに表示したい。 データオブジェクトは、問題のビューにいるときにそこにあるとして開発者コンソールに表示されます。オブジェクトの詳細を角度で取得するにはどうすればよいですか?

マイビュー:

<ion-view cache-view="false" ng-controller="PostCtrl"> 
    <ion-nav-title>{{ viewname }}</ion-nav-title> 
    <ion-content class="has-header contentpane"> 

     <div class="titlepane"> 
      <h4 class="posttitle"> 
       {{item.title}} 
      </h4> 
      <p class="categorytitle"> 
       {{item.category}} 
      </p> 
     </div> 

    </ion-content> 
</ion-view> 

コントローラ:

firebaseApp.controller('PostCtrl', function ($scope, firebaseApi, $stateParams) { 
'use strict'; 

// Create a name for the view to show as the title 
$scope.viewname = 'Svampe'; 

// The stateParams is defined in the Services.js and defined in the scope here. 
$scope.id = $stateParams.id; 

// API call to the firebase for a specific post 
firebaseApi.getSingle($scope.id).then(function (succ) { 
    $scope.item = succ; 
    console.log("Items", $scope.item); 
}, function(err) { 
    console.log('Error: ', err); 
}); 

}); 

あなたはデータがビューに表示されていない理由を任意のアイデアを持っていますか?私はオブジェクトが正常に取得されていることがわかりますが、表示されていません。

+0

あなたは私の** $のscope.item **オブジェクトを表示することができます。 – NNR

+0

{ "データ":{ "カテゴリ": "データウェアハウス"、 "説明": "任意の対象についてのダミーテキストのテキスト記述。"、 "ID":1、 "imgpath":「IMG/database.png」、 "タイトル": "データウェアハウス" }、 "ステータス":200、 "設定":{ "方法": "GET"、 "transformRequest":[ ヌル] "transformResponse":[ ヌル]、 "URL": "https://database.firebaseio.com/1.json"、 "ヘッダ":{ "accept": "application/json、text/plain、*/*" } }、 "statusText": "OK" } – krillebimbim

答えて

関連する問題