Skip to content

Instantly share code, notes, and snippets.

@andreisebastianc
Last active October 10, 2016 09:26
Show Gist options
  • Save andreisebastianc/87f0cf0e8ed095a1e891d7335630081f to your computer and use it in GitHub Desktop.
Save andreisebastianc/87f0cf0e8ed095a1e891d7335630081f to your computer and use it in GitHub Desktop.
Some angular2 dummy component
import {
Component
} from "@angular/core";
interface User {
name: string;
image: string;
fullname: string;
}
@Component({
selector: 'app',
template: `
<div class="app-wrapper">Hi, I'm working!</div>
<user-profile [profile]="user"></user-profile>
`
})
export class App {
user: User
constructor() {
this.user = {
name:"test",
image:"/public/default-user-profile.jpg",
fullname: "test test test"
};
}
}
import {
Component,
Input
} from '@angular/core';
interface Profile {
name: string;
image: string;
}
@Component({
selector: 'user-profile',
template: `
<div *ngIf="profile">
<div class="profile">
<img
class="profile-image"
src={{profile.image}}
/>
<span class="profile-name">{{profile.name}}</span>
</div>
</div>
`
})
export class UserProfileComponent {
@Input() profile: Profile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment