Good malt,
I'm trying to create a simple parameter on my route in angularjs. What I intend is that my job page whenever I load in an article open in another page the information of that article. I can get the ID but the information does not seem to me at all. It says that the id is not defined.
My code is as follows:
app.js
.when("/job" , {
templateUrl: "app/components/job/views/job.html",
controller: "job"
})
.when("/job/:jobId" , {
templateUrl: "app/components/job/views/jobdetail.html",
controller: "job_detail"
})
job.js
$scope.products = [];
$http.get('app/components/job/controller/teste.json').success(function (resource) {
$scope.products = resource;
});
$scope.jobId = $routeParams;
job_detail.js
app.controller("job_detail", ["$scope", "$http", "$location", "$route","$rootScope", "$routeParams", function($scope, $http, $location, $route, $rootScope, $routeParams) {
$scope.products = [];
$http.get('app/components/job/controller/teste.json').success(function (resource) {
$scope.products = resource;
});
$scope.jobId = $routeParams.jobId;
console.log($scope.jobId);
$scope.params = $scope.jobId.get(id);
}]);
html job:
<article dir-paginate="product in filteredJobs | filter:searchTerm | orderBy: sorting.order:sorting.direction | itemsPerPage:5" id="{{product.id}}" class="productlist product col-sm-12">
<div class="inner-content">
<div class="clearfix">
<div class="col-md-8 col-sm-8 col-xs-8">
<h4 class="productname" name="{{product.Categoria}}"><a data-ng-href="#/job/{{product.id}}">{{product.Title}}</a></h4>
<h4 style="color: gray;"><a data-ng-href="#/empresa">{{product.Empresa}}</a></h4>
<span class="glyphicon glyphicon-map-marker" style="float:left; padding-right: 15px;"><h6 style="display: inline">{{product.Localidade}}</h6></span>
<span class="glyphicon glyphicon-time" style="float:left;"><h6 style="display: inline;">{{product.Horario}}</h6></span>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<a class="thumb" data-id="{{product.id}}" data-ng-href="#/product/{{product.id}}">
<img ng-src="{{product.Image}}" class="img_jobs">
</a>
</div>
</div>
</div>
</article>
job_detail html:
<!-- Job Section -->
<section id="slide" class="job-section">
<article id="{{product.id}}" class="productlist product col-sm-12">
<div class="inner-content">
<div class="clearfix">
<div class="col-md-8 col-sm-8 col-xs-8">
<h4 class="productname" name="{{product.Categoria}}">{{product.Title}}</h4>
</div>
</div>
</div>
</article>
</section>