L
L
LittleFatNinja2016-10-26 16:49:42
JavaScript
LittleFatNinja, 2016-10-26 16:49:42

How to iterate an array outputting a div using angular 2?

ajax ohm flies an array var foo = [1,2];
how to iterate this array inserting each value at a specific location in some div that works like an output template like

<div class="mt-list-head list-simple ext-1 font-white bg-green-sharp">
    <div class="list-head-title-container">
      <h3 class="list-title"> (СЮДА) </h3>
    </div>
  </div>

and put in <div class="container"></div>, located in the house tree
, that is, at the output you need to get
<div class="container">
<div class="mt-list-head list-simple ext-1 font-white bg-green-sharp">
    <div class="list-head-title-container">
      <h3 class="list-title"> 1 </h3>
    </div>
  </div>
<div class="mt-list-head list-simple ext-1 font-white bg-green-sharp">
    <div class="list-head-title-container">
      <h3 class="list-title"> 2 </h3>
    </div>
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Medin K, 2016-10-26
@medin84

Go to https://angular.io/docs/ts/latest/tutorial/
if you're too lazy plnkr.co/edit/fcYgJVxMyAWl4qaJC4v1?p=preview see app.component

M
Max, 2016-10-26
@AloneCoder

This information is in any helloworld, sorry, todolist app for angular

A
Alexander Pozharsky, 2016-10-26
@alex4321

ng-repeat.
But in general - wasn't it found for some "angular foreach", "angular for loop"?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question