Skip to content

Instantly share code, notes, and snippets.

@stongo
Last active December 14, 2015 22:59
Show Gist options
  • Save stongo/5162473 to your computer and use it in GitHub Desktop.
Save stongo/5162473 to your computer and use it in GitHub Desktop.
navigating to Tiger Controller routes with multiple arguments in a Appcelerator Titanium App
var globals = {}
, Tiger = require('lib/tiger')
, Route = require('lib/tiger.route')
(function() {
var AppTabGroup = require('ui/AppTabGroup')
, HomeWindow = require('ui/HomeWin')
, AnotherWindow = require('ui/AnotherWin');
var HomeWin = new HomeWindow();
var RxWin = new RxWindow();
globals.tabs = new AppTabGroup(
{
icon:'icons/53-house.png',
title:'Home',
window:HomeWin
},
{
icon: "icons/195-barcode.png",
window: AnotherWin,
title: 'AnotherWin'
}
);
globals.tabs.open();
})();
// Controller and Routes
var routeController = new Tiger.Controller();
routeController.routes({
// starting routes with a "/" causes some issues, so would avoid it if possible
'home':function() {
globals.tabs.setActiveTab(0);
},
'another':function() {
globals.tabs.setActiveTab(1);
},
'helloworld/*string/*destination':function(params) {
var string = params.string || 'hello world'
, destination = params.destination || 'home';
alert(string);
routeController.navigate(destination);
}
});
routeController.navigate('/helloworld', 'bonjour monde', 'another');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment