Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. export class Recipe {
  2. constructor(public name, public description, public imagepath){}
  3. }
  4.  
  5. import {Component,Input} from "@angular/core";
  6. import {Recipe} from '../recipe'
  7.  
  8. @Component({
  9. moduleId:module.id,
  10. selector: "recipeitem",
  11. templateUrl: "./recipeitem.html"
  12. })
  13. export class RecipeItemComponent {
  14. @Input() recipe:Recipe;
  15. }
  16.  
  17. <a href="#" class="list-group-item clearfix">
  18. <div class="pull-left">
  19. <h4 class="list-group-item-heading">{{recipe.name}}</h4>
  20. <p class="list-group-item-text">{{recipe.description}}</p>
  21. </div>
  22. <span class="pull-right">
  23. <img class="img-responsive" src="{{recipe.imagePath}}" alt="No Image"/>
  24. </span>
  25. </a>
  26.  
  27. import {Component} from "@angular/core";
  28. import {Recipe} from '../recipe'
  29.  
  30. @Component({
  31. moduleId:module.id,
  32. selector: "recipeList",
  33. templateUrl: "./recipeList.html"
  34. })
  35. export class RecipeListComponent {
  36. constructor() {}
  37. recipes:Recipe[]=[
  38. new Recipe('Gobi','Very Tasty','../../images/gobi.jpg'),
  39. new Recipe('jamoon','Sweet','../../images/jamoon.jpg')
  40. ];
  41. }
  42.  
  43. <div class="row">
  44. <div class="col-xs-12">
  45. <a class="btn btn-success">New Recipe</a>
  46. </div>
  47. </div>
  48. <div class="row">
  49. <div class="col-xs-12">
  50. <ul class="list-group">
  51. <recipeitem *ngFor="let recipe of recipes" [recipe] ="recipe"></recipeitem>
  52. </ul>
  53. </div>
  54. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement