ngif

    0热度

    2回答

    我从angular.js切换到angular2/4和无法理解我应该如何实现以下模式... <div *ngFor="let item of items" (mouseenter)="focus=true" (mouseleave)="focus=false"> <span>{{text}}</span> <i *ngIf="focus" class="fa fa-penci

    3热度

    1回答

    我有一个简单的Angular 2服务调用本地JSON文件。我可以在general.service.ts的.map函数中将对象传递给console.log。但是,由于异步调用的性质,我似乎无法从对象中打印出单个键或值。这是我的代码。 我知道我需要包含* ngIf,因为它是异步的。然而,即使我已经使用了ngIf与 'generalInfo' 它引用component.ts general.servic

    0热度

    3回答

    HTML <figure class="daysearch-cover__image"> <img src="fh.jpg" *ngIf="!showBirthdayTheme"> <img src="fhbt.jpg" *ngIf="showBirthdayTheme"> </figure> 我登录,在控制台showBirthdayTheme变量。它明确表示

    2热度

    2回答

    我有点困惑。如果结果有几种情况之一,我需要隐藏块。但似乎它不能正常工作... <div *ngIf="currentStatus !== 'open' || currentStatus !== 'reopen' "> <p padding text-center class="text-notification">{{message}}</p> </div> 它刚刚出现与其他条

    1热度

    1回答

    我想在某些网格汽车组件中从数组可见的数组渲染对象。此外,我想根据我的组件中的变量(即gridCols*maxRows,使用*ngIf条件检查)将网格数限制为一个值。 我知道在同一个元素上同时使用*ngFor和*ngIf是不可能的。所以我需要使用<template ngFor ...> 来包装我的网卡元素,这些元素将根据*ngFor进行有条件渲染。鉴于此,我如何可以参考或content变量*ngFo

    0热度

    1回答

    在这里,我有JSONOBJ的结果:在我的Home.html与方法navigate()它看起来像这样 我有ion-card: navigate(event, exercise, exercise2, exercise3, exercise4){ this.navCtrl.push(exerciseSlides, { clickedExercise: exercise,

    0热度

    1回答

    我有一个动态的模板,我收到一条错误: Template parse errors: Unexpected closing tag "button". It may happen when the tag has already been closed by another tag. 这里是我的模板: <ion-col> <button *ngIf=!editMode" class="

    0热度

    2回答

    我从服务器获取一些数据,并使用ngFor向他们展示(这是搜索功能),但是当没有结果,我想显示的文字说“毫无结果” 我怎样才能做到这一点? 我尝试这样做,但迄今为止,这是行不通的。 <div *ngIf="teaInfo != '{}'"> <div class="starter-template text-xs-center"> <h5 style = "text-al

    1热度

    1回答

    在我的模板我已经得到了很多有关我的用户权限和产品上的权利的条件,例如: <div ng-if="user.rights == 'admin' || user.rights == 'owner' || products.rights.technical"></div> 放入系统的权利不能被改变无去一个新的页面...所以我想我可以使用一个绑定::以获得更好的性能。 我想: <div ng-if="

    0热度

    4回答

    嗨,我很难理解ngIf。 目前我有 Profile:{ 0:{name: 'Jen', intro:'', gender:'female', age:'1992'}, 1:{name: 'John', intro:'Hi', gender:'male', age:'1988'} } 第一个对象的介绍是空字符串,当它具有空字符串我想显示“用户不写它尚未” JSON对象。 我试过