#104848
Dawud Tan
Participant

the error is my route is not functioning as expected when I specify a path to an external HTML file, but instead it is just showing 404 not found error, the route configuration that I have passed as parameter to the setRoutes method is correct as explained in the documentation:

template: string - either the id of a local HTMLTemplateElement or a path to an external HTML file. The HTML contents serves as a template for the view of the route.

$(() => {
const router = new Smart.Router('tampilanUtamanya', '${mvc.basePath}/coba');

router.setRoutes([{
path: '/',
template: 'tampilanBeranda',
title: 'Rumahnya'
},
{
path: '/cip',
template: './tentang/templatTentang.htm',
title: 'Tentangnya'
},
{
path: '/hubungi',
template: 'templatHubungi',
title: 'Hubungilah'
},
{
path: '/lainu',
template: 'laine',
title: 'lain2'
}
]);

router.route('/');
});

When I specify just the id of a local HTMLTemplateElement, it could be functioning as expected.

  • This reply was modified 1 year, 3 months ago by Dawud Tan.