The following command will create a new branch from the specific commit, you can find the commit id by git log command or from the git history.
1
git checkout -b new_branch commit-hash
Undo
1. Undo last commit
git reset --soft HEAD~1 // undo the last commit and keep the changes in working directory.
git reset --hard HEAD~1 // undo the last commit and remove all changes.
2. Undo staged changes(not committed yet)
git reset HEAD file-name // unstage a file
git reset HEAD . // unstage all files
3. Undo unstaged changes(changes are not added or committed)
git checkout -- . // undo all changes in the working directory, same as git checkout .?
git checkout -- file-name // undo changes in a specific file
git checkout -- '*.js' // undo changes in all js files
4. Undo untracked files
git clean -f // remove untracked files
git clean -f -d // remove untracked files and directories
git restore和git reset的区别是什么?
Stash
git stash – save the changes git stash list – list all stashes git stash apply "stash@{n}" – apply the nth stash git stash apply n – apply the nth stash git stash pop – apply the latest stash and remove it from the stash list
Chrome
F12 - Open developer tools
Ctrl + Shift + P - Open command palette(only works after you open developer tools)
Ctrl + P - Open file(after you open developer tools), this is pretty useful when you want to find a file in the source tab.
Ctrl + Mouse Left Click - Open a link in a new tab. (also can use Mouse Wheel click)
Yarn
Input chrome://settings in the address bar to open the settings page.
Jest
jest - Run all test
jest --coverage - Run test with coverage report
jest --watch - Run test in watch mode
jest test.spec.ts - Run a specific test file
jest test.spec.ts --coverage - Run a specific test file with coverage report
可以在routerLink中同时定义多个辅助路由,在app.component.html文件中,添加如下代码,当我们点击Book List and Details按钮时,将同时显示book-list和book-detail组件。Url也将变为http://localhost:4200/book(detail:book-detail//list:book-list)。
1 2
<!-- app.component.html --> <a [routerLink]="[{outlets: {list: 'book-list', detail: 'book-detail'}}]">Book List and Details</a>
//app.component.ts @Component({ //... templateUrl: './app.component.html', imports: [ FormsModule// this is must be. ] }) exportclassAppComponent { name = 'Philip'; }
Posted onEdited onInhtml Symbols count in article: 173Reading time ≈1 mins.
Introduction
<select> is a form control element that allows users to select an option from a list of options. It is used to create a drop-down list. <option> is a child element of <select>, which represents an option in a drop-down list.
bootstrapModuleFactory<M>( moduleFactory: NgModuleFactory<M>, options?: BootstrapOptions, ): Promise<NgModuleRef<M>> { // Note: We need to create the NgZone _before_ we ins // as instantiating the module creates some providers // So we create a mini parent injector that just cont // pass that as parent to the NgModuleFactory. const ngZone = getNgZone( options?.ngZone, getNgZoneOptions({ eventCoalescing: options?.ngZoneEventCoalescing, runCoalescing: options?.ngZoneRunCoalescing, }), );
// Note: Create ngZoneInjector within ngZone.run so that all of the instantiated services are // created within the Angular zone // Do not try to replace ngZone.run with ApplicationRef#run because ApplicationRef would then be // created outside of the Angular zone. return ngZone.run(() => {...}); // <------- Here }