0

ビューを切り替えたり、ビューを別のビューに渡したりすることに頭を悩ませようとしています。

kimono API を呼び出しているアプリがあります。これは超音速の背景ですべてセットアップされており、問題なく表示されます。API に 1 つの文字列と 2 つのオブジェクトがあります。イベントと呼ばれるページを使用して、イベントの完全なリストを呼び出すページがあります。

{{ イベント.イベントの説明 }}

The Event#Index controller is:

    angular
      .module('event')
       .controller("IndexController", function ($scope, Event, supersonic) {
        $scope.events = null;
        $scope.showSpinner = true;

    Event.all().whenChanged( function (events) {
        $scope.$apply( function () {
          $scope.events = events;
          $scope.showSpinner = false;
        });
    });
    });

And all of that displays properly. The issue is when I click on one of those items shown which should go to the specific event I get nothing. And I'm sure I'm doing this wrong or don't understand enough about switching views. I've read many examples, but I'm not getting how it all goes together.

これが私のイベント#ショーページです。この時点で情報を読み込もうとしているだけの非常に一般的なものです。

<div ng-controller="ShowController">
  <super-navbar>
    <super-navbar-title>
      Show
    </super-navbar-title>
  </super-navbar>
<div class="padding">
  {{ event.eventdescription }}
</div>
</div>

そしてショーコントローラー:

angular
  .module('event')
  .controller("ShowController", function ($scope, Event, supersonic) {
     $scope.events = null;


        Event.all().whenChanged( function (events) {
            $scope.$apply( function () {

            });
        });
      });

そして、これは常に空白のページを返します。ログを確認すると、 Undefined.undefined と表示されていますが、それが何を意味するのかわかりません。

これに関する洞察は大歓迎です。appgyver docs で、私は何かを見ました。

var view = new supersonic.ui.View("bananas#show");
                                    supersonic.ui.layers.push(view);

しかし、私はこれをどのように使用するかわかりませんか?どんな洞察も高く評価されます。

だから、更新しました:

これが私が取り組んでいるevent#indexです。

<div ng-controller="IndexController">
  <super-navbar>
    <super-navbar-title>
      Event Index
    </super-navbar-title>
  </super-navbar>

    <ul class="list" ng-hide="events.length == 0">

          <super-navigate view-id="event#show" data-params-id="{{event.id}}" ng-repeat="event in events">

        <li class="item item-icon-right">
          <h2 ng-bind="event.EventTitles['text']"></h2>
      <img ng-src="{{ event.HeadlineImages.src }}" width="100px" height="100px">
      <p> {{ event.eventdescription }} </p>

          <i class="icon super-ios7-arrow-right"></i>
        </li>
      </super-navigate>
    </ul>
  </div>

そしてインデックスコントローラー

 angular
  .module('event')
  .controller("IndexController", function ($scope, Event, supersonic) {
    $scope.events = null;

    Event.all().whenChanged( function (events) {
        $scope.$apply( function () {
          $scope.events = events;

        });
    });
  });

ショーの HTML ページ。

<div ng-controller="ShowController">
  <super-navbar>
    <super-navbar-title>
      Show
    </super-navbar-title>
  </super-navbar>

  <div class="padding">
     <p>
      {{event.eventdescription}}
     </p>
  </div>
</div>

ショーコントローラー

angular
  .module('event')
  .controller("ShowController", function ($scope, Event, supersonic) {
    supersonic.ui.views.current.params.onValue( function (Event) { 

    $scope.events = event.id; 

});
Event.find($scope.events).then( function (Event) {
$scope.$apply( function () {
 $scope.event = Event;

  });
  });


  });

そして、structure.coffeeも更新しました

 rootView:
    location: "event#index"

  preloads: [
  {
  id: "event#show"    
 }
 {
  id: "using-the-scanner"
  location: "example#using-the-scanner"
 }
 ]

どんな助けでも大歓迎です。

4

2 に答える 2

0

わかりました、これを機能させるために数週間試みた後、私はまだこれを機能させることができませんでした..これで最終的にどこかに到達していると思います...ここでの最大の問題はKimono と AppGyver を使用しています。JSON ファイルは、以下を使用して Kimono で更新されました。

function transform(data) {
  data.results.collection1 = data.results.collection1.map(function(o) {
    o.eventdescription = {
      text: o.eventdescription
    }
    return o;
  });
  return data;
}

これにより、API として App Gyver にエクスポート/入力される JSON ファイルがクリーンアップされ、すべてのパーツがオブジェクトになります。(大したことではないかもしれませんが、これをできるだけきれいにしたかっただけです)。Kimono Modify Results ボックスでこのスクリプトを使用する前後のアイデアを提供するには --> BEFORE:

"EventTitles": {
"href": "http://",
"src": "http://.jpg",
"text": "Lorem Ipsum"
},
"HeadlineImages": {
"href": "http://",
"src": "http://.jpg",
"text": "Lorem Ipsum"
},
"eventdescription":"Lorem Ipsum" 
},

eventdescription をオブジェクトではなく文字列として残し、次に AFTER:

"EventTitles": {
"href": "http://",
"src": "http://.jpg",
"text": "TEXT"
},
"HeadlineImages": {
"href": "http://",
"src": "http://.jpg",
"text": "TEXT"
},
"eventdescription": {
"text": "TEXT"
}, 

したがって、これを Kimono で実行すると、すべてのエントリが「オブジェクト」であることがわかります。そして、リンクの apikey の後に &kimmodify=1 を次のように使用します。

https://www.kimonolabs.com/api/{indentifier}{apikey}&kimmodify=1

次に、AppGyver コミュニティによって説明されたように、ShowController を使用して適切な/実現可能な URL 文字列をshow.html.

/app/tier/showid=123456789インデックスから特定のエントリビューに移動するときのようなものを作成する必要があります。

(URL は、AppGyver のデバッグ モードを使用して、Mac 上の Safari Web Inspector と IOS Emulator を使用して見つけるかhttp://localhost:[some port number]/location/of/app、Android Emulator (推奨される Genymotion) を使用するときに使用するブラウザーを使用して見つけます。

したがって、これを行うには、Kimono で API ハッシュ追加 &kimhash=1 を URL の最後に使用し、APIKEY の後、次のような変更の前に行います。

https://www.kimonolabs.com/api/{indentifier}{apikey}&kimhash=1&kimmodify=1

. 参照: Kimono API Docs- Re:Hash

これは次のようなものを作成します

"EventTitles": {
"href": "http://",
"src": "http://.jpg",
"text": "TEXT"
},
"HeadlineImages": {
"href": "http://",
"src": "http://.jpg",
"text": "TEXT"
},
"eventdescription": {
"text": "TEXT"
}, 
"hash":"1a2b3c4d5e6f7g8h9z"},

エントリごとにランダムな「識別子」が作成されます。

今、それが私が今立ち往生しているところです。...入る必要がある API URL は次のとおりです。

https://www.kimonolabs.com/api/{indentifier}{apikey}&kimhash=1&kimmodify=1

また、バックエンドで API を構成するときに、この新しい &kimhash=1&kimmodify=1 を入力する領域がありません。これは、URL の最後に配置して、正しくフォーマットされた ID の API を呼び出す必要があります。ご覧のとおり、これを行うための参照はありません。

http://docs.appgyver.com/supersonic/guides/data/other-data-providers/kimono-labs/

これは、これをすべて理解し、最終的にこれを立ち上げて機能させるための次の最後のステップだと思います. 最後に、この最後の部分をどうにかして理解できるかどうかについて、ある程度自信を持っている ShowController に id をプルすることを明らかに再検討します。

何か案は??

于 2015-04-14T23:58:53.140 に答える