1

I want to serve AngularJS application using spring boot (using embedded tomcat server). When I am serving the application by requesting index.html every thing is working fine. , but I want to directly serve the required view along with index.html.

For example,

If I have multiple views like view1.html, view2.html(div elements) and one of these views can be included in index.html. I want to create mapping using controller in springboot app which can directly load index.html with view1.html or view2.html depending upon the url pattern..

(\pattern1 -- will load the index.html along with view1. 

html and \pattern2 -- will load the index.html along with view2).
2
  • Are you using some kind of Angular router such as ui-router? Commented Feb 16, 2017 at 14:22
  • yes... but I to want serve directly a particular view as part of index.html depending on url pattern. Commented Feb 16, 2017 at 14:29

1 Answer 1

1

You could read your url from Angular with something like:

$routeProvider.when('/view1/:param1/:param2', {
    templateUrl: 'view1.html',    
    controller: 'MyCtrl1'
});

So depending on your url, template is changed at the time you access the view. Of course you can manage it trough "states" via $stateProvider.

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.