I got alot of progress in my previous project and needed a final piece of help i just cant seem to get.
I build my whole angular controller with all the data that needs to populate on the page, but i need to filter by a specific value being passed from another page.
I decided to do query string, but i am lost how to retrieve my 2 parameters, 1 being used in this section, 1 being used further down the page. I tried using jquery url (project) but in the jquery call i can't connect it to the angular scope object.
How do i use the resource or the location provider correctly to accomplish this?
url example:http://localhost/Client/activitysubpage.asp?activity=6&day=1 Note:earlier in the page i call the ng-app and the ng-controller directives.
I have the angular library as well as the jquery library loaded. //What i made to grab the url item uses url.js
<script>
$(document).ready(function () {
var myactivity =url('?activity');
var myday = url('?day');
$scope.currentactivity = myactivity;
//I tried saving the value to a input variable and using ng-bind but it doesnt see the initial value.
// $("#activityitem1").val(myactivity);
});
</script>
<input ng-model="currentactivity" id="activityitem1">
<h1>NG-MODEL VALUE IS {{currentactivity}}</h1>
<div class="item item-bg-center-contain">
<div ng-repeat="items in activities | filter:{id : myactivity }:true">
<img ng-src="assets/images/activities/headers/{{items.id}}.jpg" class="img-responsive" style="width:100%;height:auto;" />
</div>
//controller/instantiation code
var myapp = angular.module("ActivitySelection", []);
myapp.controller("ActivityController", function ($scope) {
$scope.shortdates = ["Thursday, January 28","Friday, January 29","Saturday, January 30"];
$scope.currentactivity = 1;
$scope.activities =
[{
"id":1,
"title":"Activity1"},
{
"id":2,
"title":"Activity2"},
......
{
"id":8,
"title":"Activity8"}
];