@muhammad-dawud91gmail-com

@muhammad-dawud91gmail-com

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Router using path to an external HTML #104850
    Dawud Tan
    Participant

    the smart.router.js that I used come from Smart HTML’s Github Repository https://github.com/HTMLElements/smart-webcomponents/releases/tag/v15.0.0
    in the source directory: /source/smart.router.js

    • This reply was modified 11 months, 2 weeks ago by Dawud Tan.
    in reply to: Router using path to an external HTML #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 11 months, 2 weeks ago by Dawud Tan.
Viewing 2 posts - 1 through 2 (of 2 total)