I hope my title wasn't too confusing. Basically what I have is a list of portfolio items whose data is gathered from a JSON file. Each portfolio item has a url that will navigate to the single portfolio item.
Here is a sample of the JSON:
[
{
"url": "nutcracker",
"name": "Nutcracker Main Street Ballet",
"snippet": "Trifold Playbill",
"imgurl": "img/nutcracker.jpg",
"keyword": "trifold brochure folder over foldover folded"},
MORE
]
And here is the controller that is gathering the data:
myApp.controller('ListCtrl', function ($scope, $http) {
$http.get('items/items.json').success(function(data){
$scope.pages = data;
});
});
And here, the routing:
config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/list', {templateUrl: 'partials/list.html', controller: 'ListCtrl'});
$routeProvider.when('/:pageUrl', {templateUrl: 'partials/single-item.html', controller: 'ItemCtrl'});
$routeProvider.otherwise({redirectTo: '/list'});
}]);
Now each portfolio item uses the 'url' datum to dictate the url. So this item would provide a url of: www.mysite.com/#/nutcracker.
What I want to do is search the URL for 'nutcracker' and then find that corresponding item in the JSON array and use it's data to populate the single portfolio page.
I hope this isn't too confusing. Please ask questions if you think you can help but may not be sure as to what I'm looking for!
Thank you very much!