Im converting a app from v1 to v2 and just wondering how to load external links from the server as an ordinary link is not working!?
I init the app, it loads the first page i a view, but when trying to load a new page from that page, noting happens. https://www.manmade.se/iphone/skolappenv2/index_webb.html Tab 3 and the “Persnr” link.
I have this list with links and it is not loading the pages, nothing happens at all, and no errors.
<li >
<a href="https://www.manmade.se/iphone/skolappenv2/schema/persnr.asp" class="item-link">
Page 2
</a>
</li>
</ul>
I don´t know what I´m missing
All pages must be specified in routes
So all of my 200 pages must be in the routes.js file!?
Ok so I have this and it is not finding routes variable even if I have copied the tab template design?
In my routes.js file.
routes: [
{
name: ‘hem’,
path: ‘/hem/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/hem.asp’,
},
{
name: ‘nyheter’,
path: ‘/nyheter/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/nyheter.asp’,
},
{
name: ‘schema’,
path: ‘/schema/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/schema/schema.asp’,
},
{
name: ‘lunch’,
path: ‘/lunch/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/lunch/menyiframe.asp’,
},
{
name: ‘mer’,
path: ‘/mer/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/mer.asp’,
},
{
name: ‘persnr’,
path: ‘/schema/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/schema/persnr.asp’,
},
];
And my app init file looks like this.
// Initialize your app
// Dom7
var $$ = Dom7;
// Init App
var app = new Framework7({
// App root element
root: ‘#app’,
// App Name
name: ‘Skolappen’,
// App id
id: ‘com.myapp.skolappen’,
theme: ‘ios’,
materialRipple:false,
// Add default routes
routes: routes,
// … other parameters
});
// Init/Create views
var view1 = app.views.create(’#view-1’, {
url: ‘/hem/’
});
var view2 = app.views.create(’#view-2’, {
url: ‘/nyheter/’
});
var view3 = app.views.create(’#view-3’, {
url: ‘/schema/’
});
var view4 = app.views.create(’#view-4’, {
url: ‘/lunch/’
});
var mainView = app.views.create(’.view-main’, {
url: ‘/mer/’,
domCache:true
});
And the page that is loaded in a view looks like this.
<li>
<a href="/https://www.manmade.se/iphone/skolappenv2/schema/persnr.asp" class="item-link">
PERSONNR
</a>
</li>
And the link to the app is https://www.manmade.se/iphone/skolappenv2/index_webb.html
So why is it not finding the routes variable and why or how should the link look like?
Thanks Vladimir.
First of all, you have a syntax error in your routes.js file https://www.manmade.se/iphone/skolappenv2/js/routes.js
It must be:
var routes = [...]
Ok fixed
But now I want to load the “persnr” link and I have tested with
a href=“https://www.manmade.se/iphone/skolappenv2/schema/persnr.asp” class=“item-link”
and
a href="/persnr/" class=“item-link”
and the routes for it looks like this.
{
name: ‘persnr’,
path: ‘/schema/’,
url: ‘https://www.manmade.se/iphone/skolappenv2/schema/persnr.asp’,
},
So what Im I missing, I don´t really understand the routes thing and why it is used Im afraid.
Thanks Vladimir
According to your route it must be
<a href="/schema/" ....
What you have in href
attribute will be compared with route path
and content of the page will be loaded from what you have in route url
Ok, thanks a lot. Got it working now.