Solved

Routing in AngularJS

Posted on 2014-02-11
2
773 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What kind of script/language created this graph? 6 62
Data Analysis 7 58
Editing .asp website 5 30
dropdownlist in asp.net vb. 3 21
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

737 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