ビューを切り替えたり、ビューを別のビューに渡したりすることに頭を悩ませようとしています。
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"
}
]
どんな助けでも大歓迎です。