小编Mer*_*ony的帖子

角度4:*ngIf有多个条件

我有点困惑.如果结果有几种情况之一,我需要隐藏块.但似乎它不能正常工作......

<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种情况.

typescript angular-ng-if angular2-directives angular

15
推荐指数
2
解决办法
6万
查看次数

Ionic 3:几页的一个标题组件

我正在从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>和它出现了.但当我把它变成另一页时 - …

typescript ionic-framework angular

14
推荐指数
1
解决办法
8178
查看次数

material2:适当改变 mat-mini-fab 尺寸和图标尺寸

抱歉,如果我重复了一个问题 - 没有找到有关我的问题的任何信息。

我正在使用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 处图标的大小以避免它?

sass material-design angular-material2 angular

10
推荐指数
4
解决办法
2万
查看次数

CVE Details API,按组件获取漏洞

我需要通过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)

是否有任何方法可以通过组件名称获取漏洞?(新旧)

parsing json get http

6
推荐指数
2
解决办法
3470
查看次数

D3角度混乱:填充颜色不会改变

使用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时查看最后一部分.如果我正在使用 …

javascript svg d3.js angularjs

5
推荐指数
1
解决办法
781
查看次数

ng-test:仅显示通过测试的结果

我正在使用 angular 和 karma 测试运行器。但是那里有很多日志。

在此处输入图片说明

如何仅显示测试结果而不显示任何其他日志信息?

karma-runner karma-jasmine angular

3
推荐指数
1
解决办法
2326
查看次数

angular 4:一一加载组件

我正在使用基于 angular 4 框架的 Ionic 3。而且我需要知道我是否有多个子组件可以异步加载它们,一个一个:

  1. 加载父级;
  2. 加载第一个孩子;
  3. 当第一个孩子加载时,加载第二个孩子;
  4. 当第二个孩子加载时,加载第三个孩子
  5. 等等

例如,我有一个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)

asynchronous ionic-framework ionic3 angular

1
推荐指数
1
解决办法
2481
查看次数