Wp-api + angular very slow load times

Hi,

I am using wp-api with angular to load posts from json. However, the load times are very very slow, even with only a single post displaying the title only.

JS

var app = angular.module('app', ['ngAnimate', 'ui.router'])
.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
	$locationProvider.html5Mode(true);
 
	$stateProvider
		.state('home', {
			url: '/',
			templateUrl: myLocalized.partials + 'main.html',
			controller: 'Main'
		})
		.state('single', {
			url: '/:ID',
			templateUrl: myLocalized.partials + 'content.html',
			controller: 'Content'
		});

	$urlRouterProvider.otherwise('/');
})

.controller('Main', ["$scope", "$http", "$stateParams", function($scope, $http, $stateParams) {

	$http.get('wp-json/posts?type=projects').success(function(res){
		$scope.posts = res;
		console.log(res);
	});

	$scope.pageClass = 'page-home';

}])
    
.controller('Content', function($scope, $http, $stateParams) {

	$http.get('wp-json/posts/' + $stateParams.ID).success(function(res){
		$scope.post = res;
		console.log(res);
	});

	$scope.pageClass = 'page-single';

})

content.html

<div class="single-wrapper">
   <h1>{{post.title}}</h1>
</div> 

loading that title on the single page takes about 1.5 second or longer.

If i check the console since i logged the response with console.log(res) it shows a HUGE object. This below is just a small part of it. I know very little about this so its just a guess.

ObjectID: 23acf: Objectprimary_color: "#003969"right_column: truethumbnail: "http://localhost:8888/gitprojects/teambartz/wp-content/uploads/2015/07/skargaardenthumb.jpg"__proto__: Object__defineGetter__: __defineGetter__() { [native code] }arguments: nullcaller: nulllength: 2name: "__defineGetter__"__proto__: Empty() {}<function scope>__defineSetter__: __defineSetter__() { [native code] }arguments: nullcaller: nulllength: 2name: "__defineSetter__"__proto__: Empty() {}apply: apply() { [native code] }arguments: nullbind: bind() { [native code] }arguments: nullcaller: nulllength: 1name: "bind"__proto__: Empty() {}<function scope>call: call() { [native code] }arguments: nullcaller: nulllength: 1name: "call"__proto__: Empty() {}<function scope>caller: nullconstructor: Function() { [native code] }arguments: nullcaller: nulllength: 1name: "Function"prototype: Empty() {}__proto__: Empty() {}<function scope>length: 0name: "Empty"toString: toString() { [native code] }__proto__: Object<function scope><function scope>No Scopes__lookupGetter__: __lookupGetter__() { [native code] }arguments: nullcaller: nulllength: 1name: "__lookupGetter__"__proto__: Empty() {}apply: apply() { [native code] }arguments: nullbind: bind() { [native code] }call: call() { [native code] }caller: nullconstructor: Function() { [native code] }length: 0name: "Empty"toString: toString() { [native code] }__proto__: Object<function scope><function scope>No Scopes__lookupSetter__: __lookupSetter__() { [native code] }arguments: nullcaller: nulllength: 1name: "__lookupSetter__"__proto__: Empty() {}<function scope>constructor: Object() { [native code] }hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }arguments: nullcaller: nulllength: 1name: "isPrototypeOf"__proto__: Empty() {}<function scope>propertyIsEnumerable: propertyIsEnumerable() { [native code] }toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }valueOf: valueOf() { [native code] }get __proto__: __proto__() { [native code] }set __proto__: __proto__() { [native code] }author: ObjectID: 1URL: ""acf: Array[0]length: 0__proto__: Array[0]avatar: "http://0.gravatar.com/avatar/60a7daa267dfd4f1e93231ebd5c57afb?s=96"description: ""first_name: ""last_name: ""meta: Objectlinks: Object__proto__: Objectname: "bartz"nickname: "bartz"registered: "2015-07-05T16:11:34+00:00"slug: "bartz"username: "bartz"__proto__: Object__defineGetter__: __defineGetter__() { [native code] }__defineSetter__: __defineSetter__() { [native code] }__lookupGetter__: __lookupGetter__() { [native code] }__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }arguments: nullcaller: nulllength: 1name: "isPrototypeOf"__proto__: Empty() {}<function scope>propertyIsEnumerable: propertyIsEnumerable() { [native code] }arguments: nullcaller: nulllength: 1name: "propertyIsEnumerable"__proto__: Empty() {}<function scope>toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }arguments: nullcaller: nulllength: 0name: "toString"__proto__: Empty() {}<function scope>valueOf: valueOf() { [native code] }get __proto__: __proto__() { [native code] }arguments: nullcaller: nulllength: 0name: "__proto__"__proto__: Empty() {}<function scope>set __proto__: __proto__() { [native code] }comment_status: "open"content: ""date: "2015-07-09T18:02:24"date_gmt: "2015-07-09T18:02:24"date_tz: "UTC"excerpt: nullfeatured_image: nullformat: "standard"guid: "http://localhost:8888/gitprojects/teambartz/?post_type=projects&#038;p=23"link: "http://localhost:8888/gitprojects/teambartz/projects/skargaarden/"menu_order: 0meta: Objectlinks: Objectauthor: "http://localhost:8888/gitprojects/teambartz/wp-json/users/1"collection: "http://localhost:8888/gitprojects/teambartz/wp-json/posts"replies: "http://localhost:8888/gitprojects/teambartz/wp-json/posts/23/comments"self: "http://localhost:8888/gitprojects/teambartz/wp-json/posts/23"version-history: "http://localhost:8888/gitprojects/teambartz/wp-json/posts/23/revisions"__proto__: Object__proto__: Object__defineGetter__: __defineGetter__() { [native code] }__defineSetter__: __defineSetter__() { [native code] }__lookupGetter__: __lookupGetter__() { [native code] }__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }propertyIsEnumerable: propertyIsEnumerable() { [native code] }arguments: nullcaller: nulllength: 1name: "propertyIsEnumerable"__proto__: Empty() {}<function scope>toLocaleString: toLocaleString() { [native code] }arguments: nullcaller: nulllength: 0name: "toLocaleString"__proto__: Empty() {}<function scope>toString: toString() { [native code] }arguments: nullcaller: nulllength: 0name: "toString"__proto__: Empty() {}<function scope>valueOf: valueOf() { [native code] }arguments: nullcaller: nulllength: 0name: "valueOf"__proto__: Empty() {}<function scope>get __proto__: __proto__() { [native code] }set __proto__: __proto__() { [native code] }arguments: nullcaller: nulllength: 1name: "__proto__"__proto__: Empty() {}<function scope>modified: "2015-07-09T18:02:24"modified_gmt: "2015-07-09T18:02:24"modified_tz: "UTC"parent: nullping_status: "open"slug: "skargaarden"status: "publish"sticky: falseterms: Array[0]length: 0__proto__: Array[0]title: "Skargaarden"type: "projects"__proto__: Object__defineGetter__: __defineGetter__() { [native code] }__defineSetter__: __defineSetter__() { [native code] }__lookupGetter__: __lookupGetter__() { [native code] }__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }arguments: nullcaller: nullcreate: create() { [native code] }defineProperties: defineProperties() { [native code] }defineProperty: defineProperty() { [native code] }deliverChangeRecords: deliverChangeRecords() { [native code] }freeze: freeze() { [native code] }getNotifier: getNotifier() { [native code] }getOwnPropertyDescriptor: getOwnPropertyDescriptor() { [native code] }getOwnPropertyNames: getOwnPropertyNames() { [native code] }getOwnPropertySymbols: getOwnPropertySymbols() { [native code] }getPrototypeOf: getPrototypeOf() { [native code] }is: is() { [native code] }isExtensible: isExtensible() { [native code] }isFrozen: isFrozen() { [native code] }isSealed: isSealed() { [native code] }keys: keys() { [native code] }length: 1name: "Object"observe: observe() { [native code] }preventExtensions: preventExtensions() { [native code] }prototype: Objectseal: seal() { [native code] }setPrototypeOf: setPrototypeOf() { [native code] }unobserve: unobserve() { [native code] }__proto__: Empty() {}<function scope>hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }arguments: nullcaller: nulllength: 1name: "isPrototypeOf"__proto__: Empty() {}<function scope>propertyIsEnumerable: propertyIsEnumerable() { [native code] }arguments: nullcaller: nulllength: 1name: "propertyIsEnumerable"__proto__: Empty() {}<function scope>toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }arguments: nullcaller: nulllength: 0name: "toString"__proto__: Empty() {}<function scope>valueOf: valueOf() { [native code] }arguments: nullcaller: nulllength: 0name: "valueOf"__proto__: Empty() {}<function scope>get __proto__: __proto__() { [native code] }arguments: nullcaller: nulllength: 0name: "__proto__"__proto__: Empty() {}apply: apply() { [native code] }arguments: nullcaller: nulllength: 2name: "apply"__proto__: Empty() {}<function scope>Global: Windowarguments: nullbind: bind() { [native code] }arguments: nullcaller: nulllength: 1name: "bind"__proto__: Empty() {}<function scope>call: call() { [native code] }caller: nullconstructor: Function() { [native code] }arguments: nullcaller: nulllength: 1name: "Function"prototype: Empty() {}__proto__: Empty() {}apply: apply() { [native code] }arguments: nullbind: bind() { [native code] }call: call() { [native code] }caller: nullconstructor: Function() { [native code] }length: 0name: "Empty"toString: toString() { [native code] }__proto__: Object<function scope><function scope>length: 0name: "Empty"toString: toString() { [native code] }__proto__: Object__defineGetter__: __defineGetter__() { [native code] }arguments: nullcaller: nulllength: 2name: "__defineGetter__"__proto__: Empty() {}apply: apply() { [native code] }arguments: nullcaller: nulllength: 2name: "apply"__proto__: Empty() {}<function scope>arguments: nullbind: bind() { [native code] }call: call() { [native code] }arguments: nullcaller: nulllength: 1name: "call"__proto__: Empty() {}<function scope>Global: Windowcaller: nullconstructor: Function() { [native code] }length: 0name: "Empty"toString: toString() { [native code] }__proto__: Object<function scope><function scope>No Scopes__defineSetter__: __defineSetter__() { [native code] }arguments: nullcaller: nulllength: 2name: "__defineSetter__"__proto__: Empty() {}<function scope>__lookupGetter__: __lookupGetter__() { [native code] }arguments: nullcaller: nulllength: 1name: "__lookupGetter__"__proto__: Empty() {}<function scope>__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }arguments: nullcaller: nullcreate: create() { [native code] }defineProperties: defineProperties() { [native code] }defineProperty: defineProperty() { [native code] }deliverChangeRecords: deliverChangeRecords() { [native code] }freeze: freeze() { [native code] }getNotifier: getNotifier() { [native code] }arguments: (...)get arguments: ThrowTypeError() { [native code] }set arguments: ThrowTypeError() { [native code] }caller: (...)get caller: ThrowTypeError() { [native code] }set caller: ThrowTypeError() { [native code] }length: 1name: "getNotifier"__proto__: Empty() {}<function scope>getOwnPropertyDescriptor: getOwnPropertyDescriptor() { [native code] }getOwnPropertyNames: getOwnPropertyNames() { [native code] }getOwnPropertySymbols: getOwnPropertySymbols() { [native code] }getPrototypeOf: getPrototypeOf() { [native code] }is: is() { [native code] }isExtensible: isExtensible() { [native code] }isFrozen: isFrozen() { [native code] }isSealed: isSealed() { [native code] }keys: keys() { [native code] }length: 1name: "Object"observe: observe() { [native code] }preventExtensions: preventExtensions() { [native code] }prototype: Objectseal: seal() { [native code] }setPrototypeOf: setPrototypeOf() { [native code] }unobserve: unobserve() { [native code] }__proto__: Empty() {}<function scope>hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }propertyIsEnumerable: propertyIsEnumerable() { [native code] }toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }valueOf: valueOf() { [native code] }get __proto__: __proto__() { [native code] }set __proto__: __proto__() { [native code] }<function scope>Global: Window<function scope>No Scopesset __proto__: __proto__() { [native code] }arguments: nullcaller: nulllength: 1name: "__proto__"__proto__: Empty() {}<function scope>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.