javascript - AppGyver Steroids Supersonic Views -
i'm trying head around switching views / passing views view.
i have app calling in kimono api, that's setup supersonic background , looks fine. have 1 string , 2 objects in api. have page calling in full list of events using page called event:
{{ event.eventdescription }}
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; }); }); }); , of displays properly. issue when click on 1 of items shown should go specific event nothing. , i'm sure i'm doing wrong or don't understand enough switching views. i've read many examples, i'm not getting how goes together. here event#show page. generic trying load information @ point.
<div ng-controller="showcontroller"> <super-navbar> <super-navbar-title> show </super-navbar-title> </super-navbar> <div class="padding"> {{ event.eventdescription }} </div> </div> and showcontroller:
angular .module('event') .controller("showcontroller", function ($scope, event, supersonic) { $scope.events = null; event.all().whenchanged( function (events) { $scope.$apply( function () { }); }); }); and returns blank page. when check log says undefined.undefined i'm not sure means.
any insight on appreciated. in appgyver docs saw called.
var view = new supersonic.ui.view("bananas#show"); supersonic.ui.layers.push(view); but i'm not sure how use this? insight appreciated.
so, updated have:
here's event#index i'm working with.
<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> and index controller
angular .module('event') .controller("indexcontroller", function ($scope, event, supersonic) { $scope.events = null; event.all().whenchanged( function (events) { $scope.$apply( function () { $scope.events = events; }); }); }); the show html page.
<div ng-controller="showcontroller"> <super-navbar> <super-navbar-title> show </super-navbar-title> </super-navbar> <div class="padding"> <p> {{event.eventdescription}} </p> </div> </div> the showcontroller
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; }); }); }); and updated structure.coffee so
rootview: location: "event#index" preloads: [ { id: "event#show" } { id: "using-the-scanner" location: "example#using-the-scanner" } ] any appreciated.
it doesn't data being set in showcontroller. commented before. think need pass id of event using <super-navigate> location property , data-params-id or whatever want parameter name be. in showcontroller can access with:
supersonic.ui.views.current.params.onvalue( function (values) { // values.nameofpropertypassedincouldbeeventid $scope.id = values.id; }); then might able access event id:
event.find($scope.id).then( function (theevent) { $scope.$apply( function () { $scope.event = theevent; }); }); now in view have {{ event.eventdescription }} there should data.
and piece when view visible meaning every time see view page fire:
supersonic.ui.views.current.whenvisible( function () { // code watching events });
Comments
Post a Comment