I am working on a job posting website. i have been able to retrieve the 
jobs listing from the database and insert them in a table using angular 
repeat. I have each job displaying on the table with the properties: jobId, 
jobTitle, jobDescription, dateAdded, dateStarted. I would like to be able 
to click on the jobId for a specific job and redirect to another view that 
will display all of that one specific job details. I have tried different 
ways but i am completely lost.  thanks in advance!
*CONTROLLER*
'use strict';
app.controller('searchResultCtrl', function ($scope, $location, Job) {
    //retrieve jobs from sql database
    $scope.jobArray = Job.query();
    $scope.job = {
        jobId: '',
        jobTitle: '',
        description: '',
        startDate: '',
        dateCreated: ''
    };
   
    $scope.maxSize = 5;  //pagination settings
    $scope.currentPage = 1;
    $scope.totalItems = 0;

    $scope.jobId = '';

    *//retrieve job from job table and reroute to different view*

    $scope.getJob = function (job) {   * //this is where i need help*
        $scope.job = job;
        $location.path('/job');
    }
});
*JOB LISTING VIEW*

<tr ng-repeat="job in jobArray.slice(((currentPage-1)*maxSize), 
((currentPage)*maxSize))track by $index">
    <td><a ng-click='getJob(job)'>{{job.jobId}}</a></td>
    <td>{{job.jobTitle}}</td>
    <td>{{job.description}}</td>
    <td>{{job.startDate}}</td>
    <td>{{job.dateCreated}}</td></tr>

*NEW INDIVDUAL JOB VIEW*

<h1>Title</h1><h2>{{job.jobTitle}}</h2><h3>Job 
Descrption:</h3>{{job.description}}<h3>Job Start 
Date</h3>{{job.startDate}}<h3>Date Created</h3>{{job.dateCreated}}<h3>Job 
Id</h3>{{job.jobId}}



-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to