Search Posts

Category: json

show rest api json response like textbox autopopulate using angular js

how to show rest api json response like textbox autopopulate using angular js I’m accessing address lookup rest API service – JSON response. I want to show my JSON response like auto-dropdown list. Rest service result has 5 JSON array list for all my search but in my below code that JSON result again filter based on the value entered in the textbox. Test Case# 1) Entered ‘google’ in textbox rest service returns 5 […]

Overriding JSON.stringify causing error

I just created a function that return JSON.stringify like this: JSON.stringify = function (item, replacer, space) { return JSON.stringify(item, replacer, space); } and it causes all these errors on angularjs: click here The reason I want to override the function is because I want to create a property in objects that tells the JSON to ignore a field, like this: JSON.stringify = function (item, replacer, space) { if (angular.isObject(item)) { var newItem = angular.copy(item); var […]

ng-repeat with some conditions

I have a JSON which has the property prizes which in some cases is like this: “prize” : { “Firstyear” : { “first” : 3000, “second” : 2000, “total” : 5000 }, “Secondyear” : { “first” : 3000, “second” : 2000, “total” : 5000 }, “Thirdyear” : { “first” : 3000, “second” : 2000, “total” : 5000 }, “total” : 15000 }, but in some cases, it’s like this: “prize” : { “first” : 4000, […]

I want to embed video on my page by fetching the trailer link from JSON data

JSON data: { “title”: “House of Cards”, “poster”: “img/hoc1.jpg”, “imdbID”: “tt1856010”, “trailer”: “NTzycsqxYJ0” }, { “title”: “Master of None”, “poster”: “img/mon1”, “imdbID”: “tt4635276”, “trailer”: “6bFvb3WKISk” } and I have to fetch “trailer”: “6bFvb3WKISk” link from JSON into my iframe link <iframe src={`{{}}?rel=0&amp;controls=0&amp;showinfo=0`} frameBorder=”0″ allowFullScreen title={{}} /> by using ng-repeat directive Please help me out Source: AngularJS

Unexpected token u in JSON at position 0 giving a null value

I know this is a duplicate but I am unable to solve this problem referring the other posts. I am very new to angular and I am trying to complete a project but am getting an error. As I click on a button, value from ng-model is taken and pushed into an array. The value here is taken as null instead. And for the same reason , column in the database that stores the value […]

Checking the duplicate key value present inside json array using Angular.js

I need to check if the duplicate key value present inside the json array using Angular.js. I am explaining my code below. var result=[{ “email”:’[email protected]’, “title”:’hello’, “start”:’yes’ },{ “email”:’[email protected]’, “title”:’hello’, “start”:’yes’ },{ “email”:’[email protected]’, “title”:’ggggg’, “start”:’No’ },{ “email”:’[email protected]’, “title”:’hel’, “start”:’No’ },{ “email”:’[email protected]’, “title”:’ggggg’, “start”:’No’ }]; if (result.length > 0) { angular.forEach(result,function(obj2){ var data={‘title’:obj2.mname,’start’}; evtArr.push(data); }) } Here my requirement is before pushing the data into evtArr it will check the duplicate value using the key- email […]

How retrive a value from JSON object sent by server in Ionic 3

So basically I’m requesting a post request to the server which in return, send a token in JSON object in this form: { token: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIyLCJpc3MiOiJodHRwczovL2hvYnVkZGllcy5jb20vYXBpL2F1dGgvbG9naW5fYXBpIiwiaWF0IjoxNTE3MzkwNTkwLCJleHAiOjE1MTczOTQxOTAsIm5iZiI6MTUxNzM5MDU5MCwianRpIjoiWUxtdXJ5TkV2UzlwSEExTyJ9.nWV7OWLYdMJmZCHNP9tFuAmZ84DwzYO00O3jQ_RfhXQ” } What I required is to append that token with the apiUrl to get the appropriate information of a user currently logged in. The server is returning this JSON object in a variable “result” as shown below: // for login the user in the app. loginUser() { //values from the […]

API end point output JSON filter in AngularJS

I have an end point API. There are four objects with keys, id, group, name and date_modified. I am using AngularJS 1 to call the API and print the output. Now, there are few multiple entries, where group and name are same but date_modified is different. To show the output, I want to filter it in a way that if group and name are same in an object then it will take the object where […]

How to give default or initial selection for md-checkbox where its data comes from JSON

I have a list of <md-checkbox> where it is repeated using JSON array. I want to give an initial selection for 2 checkboxes. Please help me on this. My js code: $scope.elecselected = []; $scope.toggle = function (elecitem, eleclist) { var idx = eleclist.indexOf(elecitem); if (idx > -1) { eleclist.splice(idx, 1); } else { eleclist.push(elecitem); } console.log(“item:”+elecitem+ ” List:”+ eleclist); }; $scope.exists = function (elecitem, eleclist) { return eleclist.indexOf(elecitem) > -1; }; $scope.electrical = [{“ID”:”161″,”Value”:”ABC”,”Name”:”AAAA […]

Next Page »