Solved

Routing in AngularJS

Posted on 2014-02-11
2
768 Views
Last Modified: 2014-02-12
Hi Experts,

I have following sample working code that uses angularjs routing on client side.Basically in reality I will have  vertical navigation bar with Add New order ,Show order and other menu items. Now what I want is if I select "Add New order" it should show  horizontal navigation bar  with "Add","Edit" and "Delete" tabs.

I am little bit confused where should I write routing details for "Add", "Edit" and Delet tabl for the  "Add New order" menu item using angularjs? I need sample working code for this.

Routing working example

THanks in Advance
0
Comment
Question by:ksd123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39852939
You can add the Angular UI router :
https://github.com/angular-ui/ui-router
One of the demo : http://plnkr.co/edit/u18KQc?p=preview

It's similar to routeProvider but you use a stateProvider instead.

I don't really like it(but I'm not god :), I prefer to use directive.
So in each oif your page add_order.html and show_order.html you can just add :
<horizontal-navigation><horizontal-navigation>

So you create a directive for this new HTML tag :

sampleApp.directive("horizontalNavigation", [function() {
	return {
		restrict:"E",
		link: function(scope, element, attrs) {
// code
		},
		templateUrl:"your-horizontal-bar.html" // the template
	};
}]);

Open in new window


anywhere you put the tag : <horizontal-navigation><horizontal-navigation>
it will be replaced by your cached template your-horizontal-bar.html
0
 

Author Closing Comment

by:ksd123
ID: 39855474
Thank you
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question