0

Given an empty document with just the bare essentials, loading js files and stylesheet:

<!doctype html>
<html ng-app="labApp">
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
    <script src="/static/lab.js"></script>
    <link rel="stylesheet" href="/static/local.css" />
    <link rel="stylesheet" href="/static/superhero.min.css" />
  </head>
  <body ng-controller="labController">
  </body>
</html>

And an empty controller in lab.js:

angular.module('labApp', [])
  .controller('labController', function() {
    var lab = this;
  });

How do I go about loading a partial view into the body? Am I supposed to do things like that manually, using jQuery, or is there some hidden facility in angular to load partials?

2
  • You might want to consider using ui-router: github.com/angular-ui/ui-router Commented Sep 29, 2015 at 18:34
  • Ah, yes, that seems like the missing cog.. Please add an answer so I can accept it ^_^ Commented Sep 29, 2015 at 18:49

1 Answer 1

0

You can do this by rendering different views with ui-router: https://github.com/angular-ui/ui-router

When loaded into your application, you can include it like this in

angular.module('app', [ui.router])

When you follow the documentation it is pretty easy to setup different routes. Good luck!

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.