I have an Angular 5 project and on the toolbar I have the following details:
Sub-menu button
Company logo
Company name
These three are fine but now I am being asked to display the following details to the right of the main menu
Person icon
Logged in username
Below is the following code in the app.component.html file
<mat-sidenav-container>
<mat-sidenav #sidenav mode="over" opened="false">
<div class="closeButton">
<mat-icon (click)="sidenav.toggle()" title="Click to close sub-menu.">clear</mat-icon>
</div>
<a>Sidenav content</a>
<a>This is a really long nameeeeee</a>
<a>Sidenav content</a>
</mat-sidenav>
<mat-toolbar>
<mat-icon class="subMenuIcon" (click)="sidenav.toggle()" title="Click to open sub-menu.">reorder</mat-icon>
<img src="./assets/images/Crest.jpg">AJ Bell Information Interface
<span flex></span>
<div style="font-size: 15px">
<mat-icon style="font-size: 25px">person</mat-icon>
USERNAME
</div>
</mat-toolbar>
</mat-sidenav-container>
<router-outlet>
<div>this</div>
<div>is</div>
<div>the</div>
<div>main</div>
<div>body</div>
</router-outlet>
As you can see I have tried using <span flex></span> and also float: right etc but with no joy at all.
I know it will be simple but I'm having coding tunnel and cant think of a solution
You can use flex: 1 1 auto;
Have a look at this example
Related
if I put my mouse pointer on one of the info buttons, it will show both tooltips. How can I prevent this? I just want to show the one tooltip, on which the mouse pointer points to. Does anyone have an idea?
Here is the code:
<div class="col-12 col-lg-6">
<div class="dx-fieldset-header">Dateianhänge<span class="dx-fieldset-header-subtext"> Download / Löschen</span></div>
<div class="dx-field">
<div class="anhang-liste">
<mat-chip-list *ngIf="data?.anhanglist.length" aria-label="Anhänge löschen">
<mat-chip *ngFor="let anhang of data?.anhanglist" class="anhang-chip">
<span class="anhang-filename" (click)="downloadAnhang(anhang)">
{{ anhang.dateiname }}
</span>
<mat-icon *ngIf="!IstAnhangBereitsInKontoauszugszeileVerwendet(anhang.id)" class="anhang-delete" (click)="deleteAnhang(anhang)">cancel</mat-icon>
<i
*ngIf="IstAnhangBereitsInKontoauszugszeileVerwendet(anhang.id)"
style="margin-left: 0.2em;"
class="fa fa-info-circle"
id="infoKontoauszugzeilenAnhang{{anhang.id}}"
(mouseenter)="toggleDefault()"
(mouseleave)="toggleDefault()"
>
<dx-tooltip
*ngIf="IstAnhangBereitsInKontoauszugszeileVerwendet(anhang.id)"
target="#infoKontoauszugzeilenAnhang{{anhang.id}}"
[(visible)]="defaultVisible"
[closeOnOutsideClick]="false"
>Verwendet in folgenden Kontoauszugzeilen:
{{zeilenNummernMitAnhang[anhang.id]}}
</dx-tooltip>
</i>
</mat-chip>
</mat-chip-list>
</div>
</div>
</div>
I am starting my journey with Angular Material and I'm stuck on one thing.
Expansion Panel is not working (I see this panel but I can't open/close it). I found out that it's not working because of "nav component" (created with material) which I am importing in this component (when I delete "nav component" expansion panel works).
And yes, I have used
import {MatExpansionModule} from '#angular/material/expansion';
This is component with Expansion Panel
<app-navigation-bar></app-navigation-bar>
<section id="faq">
<h2>FAQ</h2>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
This is the expansion title
</mat-panel-title>
<mat-panel-description>
This is a summary of the content
</mat-panel-description>
</mat-expansion-panel-header>
<p>This is the primary content of the panel.</p>
</mat-expansion-panel>
</section>
And here is code of the "nav component"
<section id="navigation-bar">
<mat-drawer-container class="example-container">
<mat-drawer class="left-nav" mode="side" opened>
<button class="nav-button"><i class="far fa-play-circle"></i></button>
<button class="nav-button"><i class="fab fa-500px"></i></button>
<button class="nav-button"><i class="fas fa-broadcast-tower"></i></button>
<button class="nav-button"><i class="fas fa-film"></i></button>
<button class="nav-button"><i class="fas fa-microphone"></i></button>
<button [routerLink]="['/faq']" routerLinkActive="router-link-active" class="nav-button"><i class="fas fa-info"></i></button>
<button [routerLink]="['']" routerLinkActive="router-link-active" class="nav-button" id="exit"><i class="far fa-times-circle"></i></button>
</mat-drawer>
<mat-drawer-content class="right">
</mat-drawer-content>
</mat-drawer-container>
</section>
And here is pic of it
I figured it out. When you are making component just for an element on site, make sure it doesn't have width: 100%; it makes foil effect on the site (you can't click any button because all content is under this component).
I'm setting up a User Interface using a simple database and angular, where users can post a message, either with only a message, or with a picture attached to the message.
By doing some research, I found out about the built in ngIf conditions, where you can display variables if the variable doesn't hold a null value.
Here is my code and the output:
<div ng-repeat="m in chatDetailsCtrl.messageList">
<!-- This card prodives space for the message and Like/dislike buttons -->
<div class="row">
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<!-- Card Title is the person who wrote the message -->
<span class="card-title">{{m.user_ID}}</span>
<!-- Here comes the message text -->
<p> {{m.post_msg}}
<div> <span class="new badge light-blue">{{m.post_date}}</span></div>
<p *ngIf="m.photo_url">
<img src="{{m.photo_url}}" width="100" height="100">
</p>
{{m.post_date|date("m/d/Y")}} -->
</p>
<td><a class="waves-effect light blue lighten-1 btn-small" ng-click="chatDetailsCtrl.postDetails(m.post_ID)">Post Details</a></td>
</div>
<div class="card-action">
<a class="btn-floating btn-small waves-effect waves-light blue" ><i class="material-icons">thumb_up
</i></a> <span ng-bind= "m.likes"> </span>
<a class="btn-floating btn-small waves-effect waves-light blue"><i class="material-icons">thumb_down
</i></a><span ng-bind="m.dislikes"> </span>
</div>
</div>
</div>
</div>
</div>
I want to see if m.post_url contains a value. When null, I want to skip adding this variable to my website.
For example, last post, without a picture, I want it to look like this:
Sorry for my bad english, english is not my first language.
first of all, you are mixing angularJs syntax with new angular.
if you are using angularjs use ng-if in your image tag. it works properly.
as I can see you are using ng-repeat and ng-bind you are using angularjs and not angular.
so in your image tag use
<p ng-if="m.photo_url">
<img src="{{m.photo_url}}" width="100" height="100">
</p>
I am using Material Design 2 to toggle the left side nav:
In the header bar template:
<button md-icon-button (click)="leftNav.toggle()" aria-label="Menu">
<md-icon>menu</md-icon>
</button>
In the left side nav template:
<md-sidenav mode="side" fxFlex="200px" #leftNav md-component-id="leftNav" opened></md-sidenav>
I am now trying to move the header bar and left side nav into separate custom components so that my app.template.html looks like this:
<div fxLayout="column">
<header-bar></header-bar>
<left-nav></left-nav>
</div>
All looks good on that page and just about everything works except the toggling of the left side nav menu, I am getting an error "cannot read property toggle of undefined". It can't find the "#leftNav" id in the left-nav component is my assumption...what is the best way in Angular 2 to go about getting these two templates to talk to each other so I can toggle the left nav component when I click on the header-bar button?
My folder structure:
layout:
header-bar:
header-bar.html
header-bar.ts
left-nav:
left-nav.html
left-nav.ts
I've seen some general other examples but nothing I've been able to apply here. Happy to provide more information if needed. Thanks
Here is the html before separating into two components:
<div fxLayout="column">
<!-- Header bar -->
<!--<header-bar></header-bar>-->
<md-toolbar color="accent" class="navbar">
<button md-icon-button (click)="leftNav.toggle()" aria-label="Menu">
<md-icon>menu</md-icon>
</button>
<span fxFlex></span>
<button md-button [md-menu-trigger-for]="menu">
My Account <md-icon>keyboard_arrow_down</md-icon>
</button>
</md-toolbar>
<md-sidenav-container fxLayout="row">
<md-sidenav mode="side" fxFlex="200px" #leftNav md-component-id="leftNav" opened>
<md-nav-list>
<md-list-item [routerLink]=" ['./dashboard'] " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<md-icon>gradient</md-icon>
<span class="padding-lr-2x">Dashboard</span>
</md-list-item>
<md-list-item [routerLink]=" ['./front'] " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<md-icon>assignment</md-icon>
<span class="padding-lr-2x">Form layout</span>
</md-list-item>
<md-list-item [routerLink]=" ['./alt'] " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<md-icon>settings</md-icon>
<span class="padding-lr-2x">Settings</span>
</md-list-item>
</md-nav-list>
</md-sidenav>
</md-sidenav-container>
</div>
In My ionic I have bottom tabs as well as top tabs after the header bar. However I see the output differently in Google Chrome and the Ionic Iphone App.
Attaching screenshots of how it looks on Google Chrome (as intended) and on the Inoic Phone app
On Google Chrome
On Ionic Iphone App
Here is the 1st Tab's HTML Code:
<ion-view view-title="TAB 1">
<ion-content >
<ion-tabs class="tabs-top tabs-icon-top has-header">
<ion-tab title="Tab1" icon-on="ion-heart" icon-off="ion-heart">
<!-- Tab 1 content -->
<div class="padding" >
<h2 class="title ">Lorem ipsum dolor sit ametr adipiscing elit</h2>
<p></p>
<ion-scroll direction="x" class="item " style="padding:5px">
<button data-ng-repeat="item in recent|filter:{tag:'!!'}" class="horizontaList button" ng-click="addFromRecent(item.id, 'tag');">
{{item.tag}}
</button>
</ion-scroll>
Here is index.html code:
<body data-ng-app="starter">
<ion-side-menus>
<ion-pane ion-side-menu-content="">
<ion-nav-bar class="bar">
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon ion-navicon" ng-click="openMenu()"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
<ion-header-bar class="bar bar-header "></ion-header-bar>
<ion-content has-header="true">
<div class="list">
<a class="item item-icon-left" href="#">
<i class="icon ion-ios-home-outline"></i>
Home
</a>
<a class="item item-icon-left" href="#">
<i class="icon ion-log-out"></i>
Log out
</a>
</div>
</ion-content>
</ion-side-menu>
</ion-side-menus>
Thanks in advance for your help!
I think your has-header class is wrong on <ion-tabs>. Quote from the ionic blog:
The beta has also removed the requirement for the developer to
manually tell the content to reposition itself if there is a header,
footer, or tabbar present. Resultantly, the has-header, has-footer,
and has-tabs attributes have been removed. Ionic now will
automatically reposition and resize the content depending on what
surrounding widgets are present. If any old alpha code references
these attributes or classnames they can be safely removed since
they’re no longer being used by the framework.