我有点困惑.如果结果有几种情况之一,我需要隐藏块.但似乎它不能正常工作......
<div *ngIf="currentStatus !== 'open' || currentStatus !== 'reopen' ">
<p padding text-center class="text-notification">{{message}}</p>
</div>
Run Code Online (Sandbox Code Playgroud)
它只是出现在其他条件下.它既不适用于1条件也不适用于2.也试过*ngIf="currentStatus !== ('open' || 'reopen') "但它只适用于1种情况.
我正在从AngularJS迁移到Angular并开始使用Ionic 3(最新版)来构建我的应用程序.
但我有一个小问题:我想在一些页面上使用一个标题,具有注销功能等.我不想在每个组件页面中实现它,我想避免重复代码.
我自己试了一下.首先,我创建了单独的头部组件
了header.html
<ion-header>
<ion-navbar color="primary-light">
<ion-title>
Super App
</ion-title>
<ion-buttons end>
<button ion-button class="button-out" icon-only (click)="signOut()">
<ion-icon class="fa fa-sign-out"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
header.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
selector: 'app-header',
templateUrl: './header.html'
})
export class HeaderComponent {
constructor(public navCtrl: NavController) {}
signOut() {
//some auth strategy and then
this.navCtrl.popToRoot();
}
}
Run Code Online (Sandbox Code Playgroud)
在我去的地方,我想补充我的头页,我做import {HeaderComponent} from './../header/header'的page.module.ts,加入HeaderComponent到declarations和entryComponents并添加到page.html中<app-header></app-header>和它出现了.但当我把它变成另一页时 - …
抱歉,如果我重复了一个问题 - 没有找到有关我的问题的任何信息。
我正在使用angular 6 with material design。我需要更改其中的按钮mat-fab-mini和图标的大小。在检查工具 html 中以这种方式呈现:
要更改大小,我使用了以下代码,但它不会使按钮内的图标尺寸变小:
html
<button mat-mini-fab class="my-fab">
<mat-icon aria-label="favorite">favorite</mat-icon>
</button>
Run Code Online (Sandbox Code Playgroud)
scss
.my-fab {
width: 20px;
height: 20px;
line-height: 16px;
.mat-button-wrapper {
padding: 2px 0 !important;
line-height: 16px !important;
width: 16px !important;
height: 16px !important;
.mat-icon {
font-size: 16px;
padding-right: 4px;
line-height: 16px;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是结果:
的属性.mat-button-wrapper根本没有改变。图标在按钮的底部,图标的大小没有改变。如何更改 material2 处图标的大小以避免它?
我需要通过JSON格式的组件来获取漏洞,但我只能通过使用CVE Details API来获得单个漏洞,其中没有任何组件或东西,只能描述.
这是一个链接的例子
http://www.cvedetails.com/json-feed.php?numrows=10&vendor_id=0&product_id=0&version_id=0&hasexp=0&opec=0&opov=0&opcsrf=0&opfileinc=0&opgpriv=0&opsqli=0&opxss=0&opdirt=0&opmemc=0&ophttprs=0&opbyp=0&opginf=0&opdos=0&orderby=3&cvssscoremin=0
Run Code Online (Sandbox Code Playgroud)
以下是JSON的示例:
{
"cve_id": "CVE-2016-4951",
"cwe_id": "0",
"summary": "The tipc_nl_publ_dump function in net/tipc/socket.c in the Linux kernel through 4.6 does not verify socket existence, which allows local users to cause a denial of service (NULL pointer dereference and system crash) or possibly have unspecified other impact via a dumpit operation.",
"cvss_score": "7.2",
"exploit_count": "0",
"publish_date": "2016-05-23",
"update_date": "2016-05-24",
"url": "http://www.cvedetails.com/cve/CVE-2016-4951/"
}
Run Code Online (Sandbox Code Playgroud)
是否有任何方法可以通过组件名称获取漏洞?(新旧)
使用D3 JS开发角度应用程序并面临我无法更改svg填充颜色的问题.
如果您查看此代码,您可以看到我创建了一个svg并尝试从我的供应商插入另一个:
function link (scope, element, attrs) {
var svgContainer = d3.select(element[0]).append("svg")
.attr("width", $window.screenX - 2*100)
.attr("id", "oil-game")
.attr("height", 1200);
var well = svgContainer.append("g");
angular.forEach(scope.d3WellDetails, function (value, key) {
var circle = well.append("circle")
.attr("cx", 55)
.attr("cy", 100 + key*115)
.attr("r", 40)
.attr('stroke', '#0897c7')
.attr('stroke-width', '5')
.attr('fill', 'white');
well.append("text")
.attr('x', 50)
.attr('y', 85 + key*115)
.attr('fill', '#0897c7')
.attr('font-size', 16)
.attr('font-weight', 900)
.text(value.Name);
well.append('svg:image')
.attr('xlink:href', '../../images/wells.svg')
.attr('x', 40)
.attr('y', 95 + key*115)
.attr("width", 30)
.attr("height", 30)
.attr('fill', '#0897c7');
});
}
Run Code Online (Sandbox Code Playgroud)
我希望你在我添加新的svg时查看最后一部分.如果我正在使用 …
我正在使用基于 angular 4 框架的 Ionic 3。而且我需要知道我是否有多个子组件可以异步加载它们,一个一个:
例如,我有一个app.module.ts带孩子的父组件:
@NgModule({
declarations: [
AppComponentPage
],
imports: [
IonicPageModule.forChild(AppComponentPage),
ChildOneComponentModule,
ChildTwoComponentModule,
ChildThreeComponentModule,
ChildFourComponentModule,
],
entryComponents: [
AppComponentPage
]})
export class AppComponentPageModule {}
Run Code Online (Sandbox Code Playgroud)
和app.component.ts:
import { Component } from '@angular/core';
//import all child components
@Component({
selector: 'app-parent-component',
template: `
<child1-component></child1-component>
<child2-component></child2-component>
<child3-component></child3-component>
<child4-component></child4-component>
`
})
export class AppComponentPage {
//HOW TO LOAD?
}
Run Code Online (Sandbox Code Playgroud) angular ×5
typescript ×2
angularjs ×1
asynchronous ×1
d3.js ×1
get ×1
http ×1
ionic3 ×1
javascript ×1
json ×1
karma-runner ×1
parsing ×1
sass ×1
svg ×1