Search Posts

Category: angularjs-filter

AngularJS filter field according to values of an array

I have an Array and this array contains some Id’s. I would like to filter my result according to Id’s. For Example please see the below code snippet. How can I show the records which ‘StatusId’ located in the ‘ids’ array? According to my example, I want to list only: AAA BBB CCC <html> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js”></script> <script> angular.module(‘myApp’, []).controller(‘ctrl’, function ($scope) { $scope.ids = [{ “id”: 1 }, { “id”: 2 }, { […]

Formating dates in AngularJS ng-repeat directive from json array

I’m obtaining a response in json format from laravel application like below: [{“id”:11,”name”:”test”,”description”:”adddas”,”isDone”:false,”created_at”:{“date”:”2017-09-06 12:23:23.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:12,”name”:”test2″,”description”:”asdasdsa”,”isDone”:false,”created_at”:{“date”:”2017-09-13 06:23:22.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:13,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 18:44:57.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:14,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 20:23:58.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:15,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 20:45:35.000000″,”timezone_type”:3,”timezone”:”UTC”}}] I’m trying to format these data in Angular js in ng-repeat directive in way like below: <div class=”table-responsive”> <table class=”table table-hover”> <thead> <tr> <th>name</th> <th>Created at</th> </tr> </thead> <tbody> <tr ng-repeat=”task in tasks”> <td>{{task.name}}</td> <td>{{ task.created_at.date | date:’yyyy-MM-dd HH:mm:ss’ }}</td> </tr> </tbody> </table> </div> The problem is with […]