Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now
Showing posts with label Angular JS. Show all posts
Showing posts with label Angular JS. Show all posts

Angular 14 version release date and new features

Angular 14 version release date and new features

So here we are, Angular 14 is going to release soon. It is expected in June.

Angular 14 is the next major update after, Angular v13 released in November 2021.

The use of modules will be optional in favour of stand-alone components.

What is the release date of Angular 14

The release of Angular 14 is expected in June. Angular 14 is currently in release candidate 0.

How to install Angular 14

At this time, Angular 14 could be installed via npm using the next flag.

Simply open a new command line interface and run the following command to install the latest version of Angular:

npm install --global @angular/cli@next

This will install the latest version of Angular CLI globally on your development machine.

Features of Angular 14

Here is the list of Major features in Angular 14.

Interesting pattern using inject() instead of constructor injection!

  • remove constructor
  • better DX
  • removes need to pass all the deps to base class manually with super(dep1, ...) when using inheritance

⚠️ only works in constructor time!

But won't work in #angular component life-cycle hooks like ngOnInit or ngOnChange because they happen AFTER constructor time 😉

// define reusable helper function...
function select(selector: MemoizedSelector) {
    const store = inject(Store);
    return store.select(selector);
    // ...simplify your container (and other) components
    @Component({
        selector: 'my-org-some-feature-container',
        template: '...'
    })
    export class SomeFeatureContainer implements OnInit {
        @Input() someParam: string;
        view$ = select(someFeatureView);
        user$: Observable < user > ; //✅works
        constructor() {
            this.view$ = select(someFeatureView); //✅works
        }
        ngOnInit() {
            // ngonInit happens during runtime                          //   ⚠️  does NOT work
            this.user$ = select(userSelectorFactory(this.someParam));
        }
    }
JavaScript

1. Angular CLI auto completion

Angular 14 adds a new functionality to the CLI that allows real-time type ahead auto completion in the terminal. This capability can be accessed using the cli.

2. Angular 14 standalone components

With the release of Angular 14, standalone components will, at last, be a feasible option, and Angular modules will no longer be required.

A standalone component is not declared in any existing NgModule, and it directly manages its own dependencies (instead of having them managed by an NgModule), and can be depended upon directly, without the need for an intermediate NgModule.

The standalone flag is used to mark the component as “standalone”.

It is a property of a metadata object of the decorator @Component.

Adding the standalone flag is a signal that components are independently usable.

Such components don’t depend on any “intermediate context” of a NgModule.

import {Component} from '@angular/core';
@Component({
  standalone: true,
  template: `I'm a standalone component!`
})
export class HelloStandaloneComponent {}
JavaScript

3. Enhanced template diagnostics in compiler

Enhanced template diagnostics are one of the new features introduced with Angular 14, making it possible for the compiler to shield developers from common coding errors in a manner similar to typescript.

Currently, the compiler doesn’t really have any warnings, and only ever fails for fatal issues that directly prevent compilation (with some minor exceptions).

These extended diagnostics will allow warnings to be easily authored to check for smaller mistakes like getting two-way binding syntax backwards ([foo])=“bar” or having extraneous operators like using foo ?? ‘bar’ when foo is not nullable.

The Proposed solution includes a new private flag in the compiler which enables “extended template diagnostic” feature.

And checks that give warning/information diagnostics about user templates which aren’t strictly fatal errors.

This issue is mostly about building the required infrastructure, but we should include one or two simple checks to validate the system.

4. Strictly Typed Reactive Forms feature

The most common request for an Angular feature on GitHub is for strictly typed forms, which, would improve the framework’s model-driven approach to the process of dealing with forms.

Consider the below example.

type User = {
    name: string;
    phoneNumber: Number;
}
JavaScript

We can represent the above User type in reactive form as shown below.

const userForm = new FormGroup({
    name: new FormControl(''),
    phoneNumber: new FormArray(0))
});
JavaScript

Let’s read the form values.

const userDetails = userForm.getRawValue();
JavaScript

The type any is very unsafe. We can change the property type easily.The above userDetails will have any type.

const name = userForm.get('name')!.value; // type `any`
userForm.controls.name.setValue(123456);  // We can do this.
JavaScript

But with the strongly typed reactive forms, the user details will have User type.But with name should be string, as it has any type we can assign numeric values as well.

Conclusion

So here we discussed some of the new feature which is coming with Angular 14, once it releases let's implement and see how exciting these features are.

Top Git Commands For Every Developers 👇

Top  Git Commands For Every Developers 👇

 

In Morden days most of the software industry using Git as source control 

Git is an important part of daily programming especially if you're working with a team and is widely used in the software industry.

In this article, We are going to learn some basic and advance Git command which we generally use daily basis.

Git is a version control system for managing the source code which keeps the track of it with many options. Basically, it is a software to track the changes of files mostly used for coders to work collaboratively and source code management during the software development.

As per Git-SCM (https://git-scm.com/)

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Basic Git Commands

In this section, we will learn some of the basic Git commands.

1. git Init

This is probably the first command you use to start a new project in Git. This command will create a blank new repository, and then you can store your source code inside this repo.

Git Command

 git init 

Or you can use the repository name with your git init command.

git init < repository name>

2. git config

Git config command is used when you are using Git for the first time, or you have a new Git installation.

This command will set up your identity - Name and Email address. And this information will be used with every commit.

Git Command

 git config global user.name "Your name"  

git config global user.email "Your email"

3. git version

As its name implies, it's just to check which version of Git you are using. At the moment, writing this guide, the latest version of Git for Windows is 2.33.1. It was released on 12th Oct 2021.

Git Command

git version

You can get Git for windows from below link

https://git-scm.com/

4. git clone

The git clone command will use an existing repository to copy. There is one main difference between the git init and git clone

You will use the Git clone when you need to make a copy on an existing repository. The git clone command internally uses the git init command first and then checks out all its contents.

Git Command

git clone <your project URL>

5. git add

The Git add command will add all the new code files or modified files into your repository. This command offers different options to add files and folders. 

Git Command

git add your_file_name (it will add a single file to your staging area)

 git add * ( this option will add all the modified and new files to the staging area)

 

6. Git Remove

To remove the file or folder from your working directory and stages deletion.

Git Command

git rm [file_name]

git rm -r [file_name]

7. git commit

This Git command is essential. Your project quality may drop if you will not use this command appropriately.

In simple words, the Git commit will add your changes to your local repository.

Git Command

 git commit m “your commit comment”


8.
git status 

This Git command is convenient to see how many files are there which need your attention. You can run this command at any time. 

You can use it in between Git add, and Git commits to see the status.

Git Command

 git status 

 

9. git branch

Most of the time, you have multiple branches in your Git repository. In simple terms, the branch is an independent line of code development. 

With the Git branch command, you can manage your branches effectively. There are many different options and switches of the Git branch. 

Git Command

1.     To list all branches:

 git branch 

2.     To create a new branch:

git branch <branch_name>

3.     To delete a branch:

git branch d <branch_name>

4.     To delete the remote branch.

git push origin delete [branch_name]


10.
git checkout

This Git command is used to switch between branches. This is one of the powerful git commands and can use used as a swiss knife, 

In simple words, here is the syntax to switch to another branch.

Git Command

git checkout <branch_name>

Also, you can create and checkout to a branch in a single like, here is the usage for that 

git checkout b <your_new_branch_name>

 

11. git push

Once you are connected with the remote repository (with the help of the git remote command), it's time to push your changes to that repository.

Git Command

 git push u <short_name> <your_branch_name>

 

git push u origin feature_branch


You should have origin and upstream set up before you use Git push. And here is the command to set up upstream.

Git Command

 git push --set-upstream <short_name> <branch_name>

 

 

 git push --set-upstream origin feature_branch

 

 

12. git fetch 

When you need to download other team members' changes, you have to use git fetch. 

This command will download all information for commits, refs, etc., so you can review it before applying those changes in your local repository.

Git Command

 git fetch 


13
. git pull

The Git pull command downloads the content (and not the metadata) and immediately updates your local repository with the latest content. 

Git Command

 git pull <remote_url>

Intermediate Level Git Commands

After the basic here is the some Intermediate level of commands Also, there are commands like Git log that will help to see the history of previous commits.

14. git remote

Git remote command acts like a border, and If you need to connect with the outside world, you have to use the Git remote command. This command will connect your local repository to the remote. 

Git Command

 git remote add <shortname> <url>



 git remote add origin

 

15. git stash

This Git command temporarily stores your modified files. You can work in stashed with the following Git command. 

Git Command

 git stash 

And you can view all of your stashes with the following command 

 git stash list 

And if you need a apply a stash to a branch, simply use apply 

 git stash apply 

 

16. git log

With the help of the Git log, you can see all the previous commits with the most recent commit appear first.

Git Command

 git log 

By default, it will show you all the commits of the currently checked out branch, but you can force it to see all the commits of all the branches with all options. 

 git log

 

all

 

17. git shortlog

The shortlog command shows you a summary from the Git log command. This command is helpful if you are just interested in the short summary. 

This command is helpful to see who worked on what as it group author with their commits.

Git Command

 git shortlog  

 

 

18. git show

Compared to the Git log, this command git show will show you details about a specific commit.

Git Command

 git show <your_commit_comment>

 

19. git rm

Sometimes you need to delete files from your codebase, and in that case, you can use the Git rm command.

It can delete tracked files from the index and the working directory.

Git Command

 git rm <your_file_name>

 

20. git merge

Git merge helps you to integrate changes from two branches into a single branch. 

Git Command

 git merge <branch_name>

This command will merge the <branch_name> into your current selected branch.

Advanced Level Git Commands

Here are the some advance level of git command ,which we use in our project as per needed.

21. git rebase 

Git rebase similar to the git merge command. It integrates two branches into a single branch with one exception. A git rebase command rewrites the commit history.

You should use the Git rebase command when you have multiple private branches to consolidate into a single branch. And it will make the commit history linear.

Git Command

 git rebase <base>

 

22. git bisect 

The Git bisect command helps you to find bad commits. 

Git Command

Ø To start the git bisect 

 git bisect start

Ø let git bisect know about a good commit

 git bisect good a123 

Ø And let git bisect know about a bad commit

 git bisect bad z123

With Git bisect you can narrow down the broken code within a few minutes.

23. git cherry-pick 

Git cherry-pick is a helpful command. It's a robust command and allows you to pick any commit from any branch and apply it to any other branch.

Git Command

 git cherry-pick <commit-hash>

 

Git cherry-pick doesn’t modify the history of a repository; instead, it adds to the history.

 

24. git archive 

Git archive command will combine multiple files into a  single file. It's like a zip utility, so it means you can extract the archive files to get individual files.

Git Command

 git archive --format zip HEAD > archive-HEAD.zip

 

It will create a zip archive of the current revision.

 

25. git pull --rebase

Most of the time, you need to do rebase (and no merge) when you use Git pull.

In that case, you can use the option

Git Command

 git pull rebase

It will help you to keep the history clean. Also, you can avoid multiple merges.

 

26. git blame 

If you need to examine the content of any file line by line,  you need to use git blame. It helps you to determine who made the changes to a file.

Git Command

 git blame <your_file_name>

 

27. git tag

In Git, tags are helpful, and you can use them to manage the release. You can think of a Git tag like a branch that will not change. It is significantly more important if you are making a public release.

Git Command

 git tag a v1.0.0


28.
git verify-commit

The git verify-commit command will check the gpg signature. GPG or “GNU Privacy Guard” is the tool used in sign files and contains their signatures.

Git Command

 git verify-commit <commit>

 

 

29. git verify-tag

In the same way, you can confirm a tag.

Git Command

 git verify tag <tag>


30.
git diff

Most of the time, you need to compare two git files or branches before you commit or push. Here is a handy command to do that. 

Git Command

Ø to compare the working directory with the local repo:

git diff HEAD <filename>

Ø to compare two branches:

 git diff <source branch> <target branch>

 

31. git citool

Git citool is a graphics alternative of the Git commit.

Git Command

 git citool

32. git mv

To rename a git file. It will accept two arguments, source and target file name.

Git Command

 git mv <old-file-name> <new-file-name>

 

 

33. git clean

You can deal with untracked files by using the Git clean command. You can remove all the untracked files from your working directory by using this command.

Git Command

 git clean

 

34. git help

There are many commands in Git, and if you need more help with any command, you can use git help at any time from the terminal. 

Git Command

git help <git_command>

 

35. git whatchanged

This command does the same thing as git log but in a raw form. And it’s in the git because of historical reasons.

Git Command

git whatchanged

 

Conclusion

In this article, I have shared the most used git commands, especially for developers. There are several other commands available for git, however, above mentioned are the topmost and popular commands.


Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now