import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
@Component({
selector: 'app-contacts',
templateUrl:'./contacts.component.html',
styleUrls: ['./contacts.component.css']
})
export class ContactsComponent implements OnInit {
private contactsUrl =
'https://public-api.wordpress.com/rest/v1.1/sites/vocon-it.com/posts';
//private contactsUrl ='http://172.28.5.11/_/custom/template';
datas: any;
constructor(http: Http) {
http.get(this.contactsUrl).subscribe(result => {
this.posts = result.json().posts;
console.log(this.posts);
this.datas = '<div *ngFor= "let post of posts" class = "col-md-6"><div
class="overview-box"><img src="{{post.author.profile_URL}}"
class="img-thumbnail" alt="">'
+
'<h2>{{post.author.first_name}}</h2><hr><p>{{post.author.email}}</p><p>${post.author.nice_name}</p>'
+'<a href="#"><i class="fa fa-angle-right"></i> Read
More</a></div></div>';
}, error => console.error(error));
}
ngOnInit() {
// this.getContacts();
}
// getContacts(): void{
// this.contactService.getContacts().
// subscribe(contacts => this.contacts = contacts);
// }
posts: string[];
//data = '<p>{{ value.template }}</p>';
does not recognize my interpolated value and displays as a string
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.