Reputation: 1421
Passing options to a regular PageControl via options is fine, but how do you pass options to a Settings page?
i.e. Settings pages using a SettingsFlyout still have the "ready: function (element, options)
" event, but how do you set the options? The navigation is set in the application activated event, but there doesn't seem to be the opportunity to set options...
WinJS.Application.onsettings = function ( e )
{
e.detail.applicationcommands =
{
"about": { href: "/settings/about/about.html", title: "About" },
};
WinJS.UI.SettingsFlyout.populateSettings( e );
}
Upvotes: 0
Views: 483
Reputation: 4773
Like @devhammer said, you're not navigating to the settings page. In fact, it's a SettingsFlyout that is just showing up over your current page. There's not really any need to pass anything though because the SettingsFlyout will have access to the state of your page. You can define a variable in your main page and then access it on the settings page.
If you have application level data, you can just tack some state onto the app object. What I do is move the var app = WinJS.Application
line that is in the default.js by default into global scope so I can access it from anywhere, and then I use that from where I need.
By the way, don't listen to the people that tell you that global scope is evil. As long as you're aware of what you're putting in global scope and why, it's just fine to use.
Upvotes: 3
Reputation: 1384
Given that you're not navigating to the page using the normal WinJS.Navigation.navigate method, I'm not sure you can pass any state beyond the title and URI for the settings pages you wish to add.
As such, the options argument on the settings page will always be undefined.
Upvotes: 1