How to add a new Row on Angular Flex-box
up vote
0
down vote
favorite
How do you add a new row while looping through your data set.
<div fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutWrap *ngIf="blogs; else loading;">
<div fxFlex="50" fxFlex.sm="100" fxFlex.xs="100" class="article_card" *ngFor="let blog of blogs">
<mat-card class="example-card">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</div>
</div>
The desired layout is 2 cards on Large and Medium view while having 1 card occupy full width for small and extra-small view.
html css angular typescript angular-flex-layout
add a comment |
up vote
0
down vote
favorite
How do you add a new row while looping through your data set.
<div fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutWrap *ngIf="blogs; else loading;">
<div fxFlex="50" fxFlex.sm="100" fxFlex.xs="100" class="article_card" *ngFor="let blog of blogs">
<mat-card class="example-card">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</div>
</div>
The desired layout is 2 cards on Large and Medium view while having 1 card occupy full width for small and extra-small view.
html css angular typescript angular-flex-layout
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How do you add a new row while looping through your data set.
<div fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutWrap *ngIf="blogs; else loading;">
<div fxFlex="50" fxFlex.sm="100" fxFlex.xs="100" class="article_card" *ngFor="let blog of blogs">
<mat-card class="example-card">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</div>
</div>
The desired layout is 2 cards on Large and Medium view while having 1 card occupy full width for small and extra-small view.
html css angular typescript angular-flex-layout
How do you add a new row while looping through your data set.
<div fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutWrap *ngIf="blogs; else loading;">
<div fxFlex="50" fxFlex.sm="100" fxFlex.xs="100" class="article_card" *ngFor="let blog of blogs">
<mat-card class="example-card">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</div>
</div>
The desired layout is 2 cards on Large and Medium view while having 1 card occupy full width for small and extra-small view.
html css angular typescript angular-flex-layout
html css angular typescript angular-flex-layout
asked Nov 11 at 21:13
GeoffreyMahugu
215
215
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43
add a comment |
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Here is how i achieved the desired layout:
<div fxLayout="row wrap" fxLayout.lt-sm="column" fxLayoutGap="15px" fxLayoutAlign=”flex-start” *ngIf="blogs; else loading;">
<ng-container *ngFor="let blog of blogs">
<mat-card fxFlex="0 1 calc(50% - 32px)" class="card_item" fxFlex.lt-sm="100%">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</ng-container>
</div>
For more info please check on this article: AG-GRID: THE BEST HTML5 GRID IN THE WORLD
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Here is how i achieved the desired layout:
<div fxLayout="row wrap" fxLayout.lt-sm="column" fxLayoutGap="15px" fxLayoutAlign=”flex-start” *ngIf="blogs; else loading;">
<ng-container *ngFor="let blog of blogs">
<mat-card fxFlex="0 1 calc(50% - 32px)" class="card_item" fxFlex.lt-sm="100%">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</ng-container>
</div>
For more info please check on this article: AG-GRID: THE BEST HTML5 GRID IN THE WORLD
add a comment |
up vote
0
down vote
Here is how i achieved the desired layout:
<div fxLayout="row wrap" fxLayout.lt-sm="column" fxLayoutGap="15px" fxLayoutAlign=”flex-start” *ngIf="blogs; else loading;">
<ng-container *ngFor="let blog of blogs">
<mat-card fxFlex="0 1 calc(50% - 32px)" class="card_item" fxFlex.lt-sm="100%">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</ng-container>
</div>
For more info please check on this article: AG-GRID: THE BEST HTML5 GRID IN THE WORLD
add a comment |
up vote
0
down vote
up vote
0
down vote
Here is how i achieved the desired layout:
<div fxLayout="row wrap" fxLayout.lt-sm="column" fxLayoutGap="15px" fxLayoutAlign=”flex-start” *ngIf="blogs; else loading;">
<ng-container *ngFor="let blog of blogs">
<mat-card fxFlex="0 1 calc(50% - 32px)" class="card_item" fxFlex.lt-sm="100%">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</ng-container>
</div>
For more info please check on this article: AG-GRID: THE BEST HTML5 GRID IN THE WORLD
Here is how i achieved the desired layout:
<div fxLayout="row wrap" fxLayout.lt-sm="column" fxLayoutGap="15px" fxLayoutAlign=”flex-start” *ngIf="blogs; else loading;">
<ng-container *ngFor="let blog of blogs">
<mat-card fxFlex="0 1 calc(50% - 32px)" class="card_item" fxFlex.lt-sm="100%">
<img mat-card-image src="{{blog.image_1}}" class="article_image">
<mat-card-content>
<h1 class="article_header">{{blog.title}}</h1>
<p class="article_caption">
{{blog.caption}}
</p>
<span class="article_date">{{blog.created}}, </span><span class="article_read_time">{{blog.read_time}} read</span>
</mat-card-content>
</mat-card>
</ng-container>
</div>
For more info please check on this article: AG-GRID: THE BEST HTML5 GRID IN THE WORLD
answered Nov 13 at 9:49
GeoffreyMahugu
215
215
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253290%2fhow-to-add-a-new-row-on-angular-flex-box%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried with *ngFor then what happens?
– Paresh Gami
Nov 12 at 5:17
@PareshGami It stacks all the cards in one row. While the desired layout should be 2 cards in one Row then start a new row with 2 more cards. How can i make that dynamic?
– GeoffreyMahugu
Nov 12 at 13:43