2

I have been over the examples and for some reason this isn't working for me, its a very simple thing

the url I need to access is

/event-details/3 

or some other number and no matter what I do to the routeParam items I can't get it to work.

here is my config for it .

now I am not doing anything with it yet, just trying to get the page to come up and right now its coming up blank or not forwarding at all

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/event-details/:item_ID', {
        controller: 'edController',
        templateUrl: 'com/modules/Events/events-detail/views/event-details.html',
        hideMenus: true,
        protectedArea: true,
        title: 'Event Details',
        menuGroup: 'Events',
        description: 'This is the event details screen',
        keywords: 'keyword',
        breadcrumbList: [{view: '/',title:'Home'},{view: '/events-main', title: 'Events Main'},{view: '/event-details', title: 'Event Details '}]
  });
}])

Based on the examples I have seen my format is correct but it doesn't seem to want to work,

any ideas ?

2
  • are you using html5Mode? and what server are you using, and what do the server routes look like? the folks that created ui-router, which is a replacement for the angular router, write a pretty in depth FAQ on this issue that you may want to read through. Commented Sep 4, 2015 at 16:08
  • any error in the console ? Commented Sep 4, 2015 at 17:03

2 Answers 2

2

Pass vairable via URL redirect eg:http://localhost/doctor?test=1

import {Component} from '@angular/core';
import {Router} from '@angular/router';
@Component({
  selector: 'app-root',
  templateUrl: './app.home.html',
})

export class HomeComponant {
title = 'Home';
constructor(
    private router: Router,

) {}

onSubmit() {
  this.router.navigate(['/doctor'],{queryParams:{test:1}});
}

}
Sign up to request clarification or add additional context in comments.

Comments

0

While it is best to always follow a common convention, I am finding that when I inherited a specific Angular/Node application that it is NOT like apps I have built or other ones that I had seen.

Example of URL routing:

Module:

.when('/outage/notes/:group?:groupid?', {
    templateUrl: 'partials/outagenotes.html'

Controller:

.controller('OutageNotesController',

function ($http, $scope, $routeParams, Categories, Tip, $location, error, $sce) {
     //.....
     var group = $routeParams.group || 1;
     $scope.groupid = $routeParams.groupid;


      $scope.detailFrame = "http://URL/" + group + "?groupid=" + $scope.groupid);

URL:

http://localhost:1337/other/#/outage/notes/10297?groupid=4

You should see how the URL relates to the routing with the module and the controller above

2 Comments

Tom, Thank you I ended up changing my when statement to when('/event-details/:itemID?', and that worked perfectly passing the value like this /event-details?itemID=3, solved it perfectly.
Glad to hear. I really don't like inheriting someone else's application which to me I don't like the when statement not being standard that I am use to , and that templateUrl ... it generates the exact file in the public/partials/ folder and it is not like it is even combining any other information the way this previous developer set things up. 2.0 is going to be interesting with Angular since I recall that controllers are "going away"

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.