0

i am new to angular js . Please help me.

i readed some blogs on angular views and route and i implemented the code for view and route . the code was not working. As I include angularoute.js to code then it works fine for me .

But in all the blogs they are not including the angularoute.js to code.

So my question is that is route logic was removed from angular.js or i am doing something wrong.

Saurabh Mahajan
  • 2,937
  • 7
  • 25
  • 32

2 Answers2

3

In angular 1.0, routing was part of the core angular.js module. Since 1.2, they've made it an external module, in an external file. What you're doing is thus fine, and the blogs you read have probably been written before angular 1.2, or neglected to precise that this additional file had to be added.

The official documentation is quite clear about it, though:

First include angular-route.js in your HTML:

<script src="angular.js">
<script src="angular-route.js">

...

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
1

I strongly suggest you to use aungular-ui-router. Basically it's the same as angular-route but it has much much more features. There are the nested views option, also you can pass parameters over different states. You can easily assert in which state you are and based on that change the view or do something else. Another aswe feature is that you can have multiple named view on a single page which means you can load different templates on this page. The documentation is pretty awesome with this one as well. You might want to take a look. Also when you have some issues you better paste some code so people could see where could something possibly be wrong.

The Angular UI - 3rd party lib.

Tek
  • 1,178
  • 1
  • 12
  • 22