0

This might seem strange but I basically want to create a HTML file that is not in anyway associated to the angular/spring boot app.

Currently:

  • 'localhost:8080/' --- (redirects to angular app at '/#!/login')

What I want:

  • 'localhost:8080/angular' --- (redirects to angular app at '/#!/login')

  • 'localhost:8080/' --- (shows me a normal self contained HTML file e.g.'test.html')

I am very new to angular and Spring so even just guiding me in the right direction would be a huge help.

Thanks.

1

1 Answer 1

1

You should use ngRoute.By the courtesy of "ngRoute" you can redirect user to specific views by the specific urls. Pls make some research about it. Let's assume you solve your view and redirect issues. How you gonna fetch data from server side? At this time I suggest you to look at service and factory objects. Hope it helps.

Sample code :

// create the module and name it exApp
// also include ngRoute for all our routing needs

var exApp= angular.module('exApp', ['ngRoute']);

// configure our routes
exApp.config(function($routeProvider) {
    $routeProvider

        // route for the home page
        .when('/', {
            templateUrl : 'pages/home.html',
            controller  : 'mainController'
        })

        // route for the about page
        .when('/about', {
            templateUrl : 'pages/about.html',
            controller  : 'aboutController'
        })

        // route for the contact page
        .when('/contact', {
            templateUrl : 'pages/contact.html',
            controller  : 'contactController'
        });
});

// create the controller and inject Angular's $scope
exApp.controller('mainController', function($scope) {
    // create a message to display in our view
    $scope.message = 'Everyone come and see how good I look!';
});

exApp.controller('aboutController', function($scope) {
    $scope.message = 'Look! I am an about page.';
});

exApp.controller('contactController', function($scope) {
    $scope.message = 'Contact us! JK. This is just a demo.';
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.