in my case i put BsDatepickerModule.forRoot() in global app.module.ts, but then I forgot to import same module inside of child module as well.
And that was my problem too. Maybe it's also yours.
in my case i put BsDatepickerModule.forRoot() in global app.module.ts, but then I forgot to import same module inside of child module as well.
import {Component, OnChanges, SimpleChanges, Input} from '@angular/core'; import { Employee } from './employee'; @Component({ selector: 'app-emp', templateUrl: './employee.component.html' }) export class EmployeeComponent implements OnChanges { @Input() employee: Employee; @Input() message: string; ngOnChanges(changes: SimpleChanges) { for (let propName in changes) { let change = changes[propName]; let curVal = JSON.stringify(change.currentValue); let prevVal = JSON.stringify(change.previousValue); console.log(curVal); console.log(prevVal); } } }
src/assets/css/myfile.css
, then I have to access it like this :<link rel="stylesheet" href="assets/css/myfile.css">
encapsulation: ViewEncapsulation.Emulated
which will append unique component attribute to component style. So that its styles can be specific to the component.encapsulation: ViewEncapsulation.None
in component meta data.import {ViewEncapsulation} from '@angular/core';
@Component({
templateUrl: 'component.template.html',
styleUrls: [`component.style.scss`],
encapsulation: ViewEncapsulation.None
})
.mdl-tabs__tab-bar {
justify-content: flex-start;
}
mdl-tabs__tab-bar
class.<p class="{{condition ? 'checked' : 'unchecked'}}">
<p [ngClass]="condition ? 'checked' : 'unchecked'">
<p [ngClass]="[condition ? 'checked' : 'unchecked']">
<ul>
<li *ngFor="let item of items; let i = index" [attr.data-index]="i">
{{item}}
</li>
</ul>
git checkout -- filename
git reset HEAD filename
git checkout -- filename
git checkout origin/master filename
git reset --hard origin/master
To view the differences going from the remote file to the local file:
git diff remotename/branchname:remote/path/file1.txt local/path/file1.txt
ngOnChanges
- called when an input binding value changesngOnInit
- after the first ngOnChanges
ngDoCheck
- after every run of change detectionngAfterContentInit
- after component content initializedngAfterContentChecked
- after every check of component contentngAfterViewInit
- after component's view(s) are initializedngAfterViewChecked
- after every check of a component's view(s)ngOnDestroy
- just before the component is destroyeddocument.onload
).(function(){...})
turns the code within (in this case, a function) into an expression, and the second pair of parentheses (function(){...})()
calls the function that results from that evaluated expression.window.onload
, because it’s often used as this:(function(){
// all your code here
var foo = function() {};
window.onload = foo;
// ...
})();
// foo is unreachable here (it’s undefined)
The function is executed right after it's created, not after it is parsed. The entire script block is parsed before any code in it is executed. Also, parsing code doesn't automatically mean that it's executed, if for example the IIFE is inside a function then it won't be executed until the function is called.
angular-cli.json
set the spec.component parameter to false
:{
...
"defaults" : {
...
"spec": {
...
"component": false
}
}
}
--spec=false
option during creationng generate component --spec=false component-name
<div class="form-group">
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
</div>
col-md-6
and col-md-5
are examples and you can use any col-md-x
class with unlimited number. just sum MUST be 12.... // other code above export class LoginComponent implements OnInit, OnDestroy { ngOnInit(): void { const body = document.getElementsByTagName('body')[0]; body.classList.add('auth'); } ngOnDestroy(): void { const body = document.getElementsByTagName('body')[0]; body.classList.remove('auth'); } ... // other code below
... // other code above export class DashboardComponent implements OnInit, OnDestroy { ngOnInit(): void { const body = document.getElementsByTagName('body')[0]; body.classList.add('dashboard'); } ngOnDestroy(): void { const body = document.getElementsByTagName('body')[0]; body.classList.remove('dashboard'); } ... // other code below
import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...