ng-bootstrap

Template reference variable returns undefined inside ng-template

巧了我就是萌 提交于 2021-01-27 08:55:13
问题 Already tried this and this solution but nothing worked. I am using Angular 7 and trying to get a reference variable which I've placed inside the ng-template tag. But it always returns undefined test-component.html <ng-template #abc> <div #xyz> </div> </ng-template> test-component.ts @ViewChild('abc') abc: ElementRef; //---> works fine @ViewChild('xyz') xyz: ElementRef; //---> undefined test-component.ts ngAfterViewInit(){ console.log(this.xyz); //---> undefined } I've tried printing it in

ng-bootstrap collapse: How to apply animations?

╄→尐↘猪︶ㄣ 提交于 2020-12-29 09:14:30
问题 I'm using Collapse: https://ng-bootstrap.github.io/#/components/collapse However, it does not animate; even not on the demo site. How should I implement this?? 回答1: Here's a good way to do it, I think, and it works both for revealing and collapsing: (though it doesn't really need ng-bootstrap anymore) template.html: <button (click)="isCollapsed = !isCollapsed">Toggle</button> <p [@smoothCollapse]="isCollapsed?'initial':'final'"> your data here </p> . component.ts: import { trigger, state,

Angular2 ng-bootstrap modal components

假装没事ソ 提交于 2020-12-29 06:17:29
问题 I have a modal component created with ng-bootstrap like follow (just a body): <template #content let-c="close" let-d="dismiss"> <div class="modal-body"> <p>Modal body</p> </div> </template> And it's angular 2 component import { Component } from '@angular/core'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'my-hello-home-modal', templateUrl: './hellohome.modal.html' }) export class HelloHomeModalComponent { closeResult: string; constructor(private modal:

how to take the value of Dropdown in ng-bootstrap?

走远了吗. 提交于 2020-08-19 16:49:20
问题 i'm using ng-bootstrap and i want to get the value of dropdown when selected . <div class="col text-right"> <div ngbDropdown placement="top-right" class="d-inline-block"> <button class="btn btn-outline-primary" id="dropdownBasic2" ngbDropdownToggle>Toggle dropup</button> <div ngbDropdownMenu aria-labelledby="dropdownBasic2"> <button class="dropdown-item">Action - 1</button> <button class="dropdown-item">Another Action</button> <button class="dropdown-item">Something else is here</button> <

How to implement ng-bootstrap 4 table sorting, pagination and filtering

走远了吗. 提交于 2020-08-01 05:22:27
问题 I am going through the official documentation of ng-bootstrap, in some of their official examples, the code is not working. In particular I am talking about this and this examples, when you open them in stackblitz. This makes it hard for me to understand how the code works so that I can implement it my way. I have seen this question but the answer is outdated as it is for angularjs. So now my questions is: How can I implement ng-bootstrap 4 table sorting, pagination and filtering as shown