angular-template

How do I select a ContentChild of a native element in Angular 6?

て烟熏妆下的殇ゞ 提交于 2020-02-02 06:09:55
问题 I have a component that uses content projection. <ng-content select="button"> </ng-content> I want to do something like this in my component: @ContentChild('button') button: ElementRef; However, when I check this.button , it is undefined both in ngAfterViewInit and ngAfterContentInit . How can I select my content child if it is a native element and not a custom component? 回答1: None of the query decorators can select native elements without a reference. @ViewChild('button') @ViewChildren(

How do I select a ContentChild of a native element in Angular 6?

空扰寡人 提交于 2020-02-02 06:08:45
问题 I have a component that uses content projection. <ng-content select="button"> </ng-content> I want to do something like this in my component: @ContentChild('button') button: ElementRef; However, when I check this.button , it is undefined both in ngAfterViewInit and ngAfterContentInit . How can I select my content child if it is a native element and not a custom component? 回答1: None of the query decorators can select native elements without a reference. @ViewChild('button') @ViewChildren(

gulp templatecache and using html URL for Dialog box

北城余情 提交于 2020-01-25 14:26:05
问题 Hi I am using the gulp plugin, to create template of all my partials and later merge it with application js script and minified. var partials: ['app/**/*.html', '!app/index.html', '!app/bower_components/**/*.html'], gulp.src(partials) .pipe(plugins.angularTemplatecache("templates.js", {module: "mainApp", root: "app/"})); All .html load properly but when I try to specify html as part of some dialog box plugin inside some controller (I am using ng-material) it throws 404. ex - $mdDialog.show({

gulp templatecache and using html URL for Dialog box

我们两清 提交于 2020-01-25 14:23:05
问题 Hi I am using the gulp plugin, to create template of all my partials and later merge it with application js script and minified. var partials: ['app/**/*.html', '!app/index.html', '!app/bower_components/**/*.html'], gulp.src(partials) .pipe(plugins.angularTemplatecache("templates.js", {module: "mainApp", root: "app/"})); All .html load properly but when I try to specify html as part of some dialog box plugin inside some controller (I am using ng-material) it throws 404. ex - $mdDialog.show({

NgModel on Input type file

回眸只為那壹抹淺笑 提交于 2020-01-23 09:12:27
问题 I'm trying to make a binding to an input field type file through ngModel on the typical Angular way like this: <input type="file" id="fileUpload" [(ngModel)]="file"> and files:any My problem is that after I have chosen a file, the value of my variable files is still undefined Here an example with stackblitz: https://stackblitz.com/edit/angular-6mbdww 回答1: You have to do it externally through (change) event <input (change)="onFileChange($event)" type="file" id="fileUpload"> And access in the

NgModel on Input type file

自闭症网瘾萝莉.ら 提交于 2020-01-23 09:09:31
问题 I'm trying to make a binding to an input field type file through ngModel on the typical Angular way like this: <input type="file" id="fileUpload" [(ngModel)]="file"> and files:any My problem is that after I have chosen a file, the value of my variable files is still undefined Here an example with stackblitz: https://stackblitz.com/edit/angular-6mbdww 回答1: You have to do it externally through (change) event <input (change)="onFileChange($event)" type="file" id="fileUpload"> And access in the

Angular Templates on Rails

两盒软妹~` 提交于 2020-01-17 05:12:30
问题 I'm using the angular-rails-templates gem. I have a folder in my /app/assets/javascripts called templates and I have included it in application.js : //= require_tree ./templates Inside of templates there is a test.html file with <h1>hello world</h1> . For some reason, test.html is not being found though, when I log out $templateCache.info() (using app.run ) in the console I have: Object {id: "templates", size: 0} 回答1: This turned out to be a sprockets incompatibility (see here) The short

Angular and IE8 — HTML5 elements not styled inside ng-view

纵然是瞬间 提交于 2020-01-15 15:30:30
问题 So I am trying to get angular working on IE8. I have followed all the steps on http://docs.angularjs.org/guide/ie and it seems to be working -- I see the content of ng-view rendered on IE8 when I switch between views. The problem is that I don't actually see any content in the inspector: .. it's just an empty ng-view tag. I can see all of the content on the page, but no styling is applied to anything inside ng-view . I am not sure whether this is an angular or HTML5 issue. I have added the

Angular rendered DOM html custom attributes

試著忘記壹切 提交于 2020-01-15 11:44:27
问题 I am new to frontend and i began using Angular. When I look to the final DOM i see code like this <style> .pane[_ngcontent-c0]~ .... } </style> <div _ngcontent-c0 class="pane" ... This is using CSS attribute selectors but my question is related with the custom attribute "_ngcontent-c0", in html5 there is a new feature with the name of "data custom attributes that are prefixed with (data-*) name. In this case the custom attribute is not using the data- syntax , this does not make the document

Angular 6 - Ng-Container - Ng-Template inside Mat-table is not working

此生再无相见时 提交于 2020-01-04 09:08:23
问题 I am loading data into the mat-table data source from an API. There is an addnewrow() method which would add a new row at the top. I am actually trying to make the first column of the table editable. (i.e) user can give input only if they create a new row. The rest of the data in the table should not be editable. So for that I use a local flag variable false by default. Based on the flag, I am creating ng-template with ng-container. . If it's a new row, the first column is the only editable