jeudi 6 avril 2017

How to Search through my api and see if the id matches with another id - ionic1/angularjs1

I am trying to search through my api and see if one of the ids that are in the api matches another id, and if so it should create a variable and add a field to that variable the field it should add it from the row with the same id.

but it is not adding it to that variable

You can see my code here:

.controller('PlayAod', ['$scope', '$http', '$state', '$stateParams', '$location', function ($scope, $http, $state, $stateParams) {
    $scope.title = 'Sample Company';
    $scope.apiusername = 'hoy';
    $scope.apipassword = '076fdf74936ebae00e7949a80f61f985';
    $scope.aodid = $stateParams.id;
    $scope.stream = "";

    $http.get('http://ift.tt/2nPMMsE' + $scope.apiusername + '&pass=' + $scope.apipassword).success(function (data) {
        $scope.aodhls = data.audios;
        if (data.audios.id == $scope.aodid) {
            $scope.stream = data.audios.hls_stream;
            $scope.play = function() {
            window.cndStream.stop();
            window.cndStream.play($scope.stream);
        }
    }
    });

    $scope.pause = function() {
        window.cndStream.pause();
    }
    $scope.stop = function() {
        window.cndStream.stop();
    }

}])

HTML

<ion-header-bar class="bar bar-dark">
    <h1 class="title"> - Photos</h1>
</ion-header-bar>

<ion-content>
 
</ion-content>

Aucun commentaire:

Enregistrer un commentaire