File

src/app/weather/weather-list/weather-list.component.ts

Description

WeatherListComponent for rendering weather forecast tile

Metadata

providers WeatherService
selector app-weather-list
styleUrls weather-list.component.scss
templateUrl ./weather-list.component.html

Index

Inputs

Constructor

constructor()

Inputs

weathers

Input binding for weather list

Type: any

import { WeatherService } from './../weather.service';
import { Component, Input } from '@angular/core';

/**
 * WeatherListComponent for rendering weather forecast tile
 */
@Component({
  selector: 'app-weather-list',
  templateUrl: './weather-list.component.html',
  styleUrls: ['./weather-list.component.scss'],
  providers: [WeatherService]
})
export class WeatherListComponent {
  /**
   * Input binding for weather list
   * @type {*}
   */
  @Input() weathers: any;

  /**
   * Creates an instance of WeatherListComponent.
   */
  constructor() {}
}
<div class="weather-container" *ngFor="let weather of weathers">
  <div class="card">
    <div class="card-body">
      <h4 class="card-title">{{ weather[0].dt | myDate | date: 'EEE, MMM d, y' }}</h4>
      <div class="card-text">
        <ul>
          <li *ngFor="let item of weather">
            <i class="owi owi-{{ item.weather[0].icon }}" title="{{ item.weather[0].main }}"></i>
            <div class="weather-info">
              <p class="time">
                {{ item.dt | myDate | date: 'hh:mm a' }}
              </p>
              <p class="temp">
                {{ item.main.temp }}&deg;C
              </p>
              <p class="min-temp">
                {{ item.main.temp_min }}&deg;C
              </p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""