Angularjs makes a simple routing function demo and angularjs routing demo

Source: Internet
Author: User

Angularjs makes a simple routing function demo and angularjs routing demo

Download the latest Angularjs version 1.3.15 from the official website.

Make a simple routing function demo

Home: index.html

<! DOCTYPE html> 

List page: list.html

<Table> <tr> <td> <strong> sender </strong> </td> <strong> content </strong> </td> <strong> date </strong> </td> </tr> <tr ng-repeat = "message in messages"> <td >{{ message. sender }}</td> <a href = "#/view/{message. id }}" >{{ message. subject }}</a> </td> <td >{{ message. date }}</td> </tr> </table>

Details page: detail.html

<Div> <strong> Project: </strong> {message. subject }}</div> <strong> Sender: </strong >{{ message. sender }}</div> <strong> date: </strong> {message. date }}</div> <strong> To: </strong> <span ng-repeat = "recipient in message. recipients ">{{ recipient }}</span> </div> <div >{{ message. message }}</div> <a href = "#/"> return to the list </a>

The following are the pitfalls of this demo:

1: the new version of Angularjs, reference routing function, need to reference the angular-route.js file separately

2: when defining a module, you also need to add a dependency on 'ngroute '.
Angular. module ('xxxx', ['ngroute '])

The above is all the content of this article. I hope you will like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.