OK, let me try this again...
I have a value coming from an ng-repeat... like this:
<div class='span3 box box-nomargin' style="margin-left: 0px !important; padding-right: 20px;" ng-repeat="site in getSites">
This is the value of "site.networkId" is all I have to get the NAME of the network.
That being said, the network ID is: "2352wdfdsf23214" for instance.
The name is in another JSON Array... So I'm trying to pass this value into a FILTER for ANGULAR like this:
<span class="utilMonSmallText">{{ name | netNames:site.networkId }}</span>
Where name is the final value I need and netNames it the filter and site.networkId is my argument from the above ng-repeat.
So here's my filter:
myApp.filter('netNames', function(myNetID)
{
console.log("Inside NetNames Filter: " + myNetID);
var networkName = _.filter(myNetID, function(name){ return name ==="name"; });
return networkName;
});
So if I had handlebars, I'd simply create a helper and poof, the needed result would be rendered. Angular; not so easy, or maybe I'm not seeing it.
The collection for networks has an ID and NAME. I simply want to replace the NAME with the ID being passed to GET the name.
Simple; right?
UPDATE: Here's my controller...
// getNetNames gets an array with all the network names in the database
$scope.getNetNames = dashboardData.getNetNames();
$scope.getNetNames.then(
function(getNetNames) {
$scope.getNetNames = getNetNames;
$scope.netName = $.grep(getNetNames, function(n, i) { // just use arr
console.log("myName inside the topo getNetNames: " + n.myNetID)
return n.myNetID === "NAME";
});
console.log("get Names inside TOPO Ctrl: " + $scope.getNetNames);
},
function(response) {
console.log(response);
});
UPDATE: Here's my SERVICE
getNetNames: function(netid) {
var deferred = $q.defer();
$http({method: 'GET', url: myNetsURL + "" + netid})
.success(function(data, status, headers, config) {
console.log("NETWORK Name: " + data);
//Push NET NAMES into array for use down below.
deferred.resolve(data);
})
.error(function(data, status, headers, config) {
deferred.reject(status);
});
return deferred.promise;
}