Angular-cli将在哪里安装?

时间:2017-06-06 08:31:22

标签: angular angular-cli

Angular.io说首先安装Angular-cli,然后创建新项目。

当我没有任何项目时,我无法理解,Angular-cli将在哪里安装?

2 个答案:

答案 0 :(得分:1)

全球安装

这是您只需要执行一次的步骤。一旦使用“-g”全局安装,您可以在创建新的Angular 2项目时跳过此步骤。另外需要注意的是,在继续执行此步骤之前,需要安装Nodejs和NPM。

它全局安装在Nodejs Modules

public class AuthController {
private AuthListener authListener;
static final int RC_SIGN_IN = 9001;
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;

public AuthController(){
    mAuth = FirebaseAuth.getInstance();
    mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                // User is signed in
                Log.d(AUTHCONTROLLER_TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                // User is signed out
                Log.d(AUTHCONTROLLER_TAG, "onAuthStateChanged:signed_out");
            }
            authListener.onUserAuthenticated(user);
        }
    };
}

public void startAuthStateListener() {
    mAuth.addAuthStateListener(mAuthListener);
}

public void stopAuthStateListener() {
    if (mAuthListener != null) {
        mAuth.removeAuthStateListener(mAuthListener);
    }
}

public void firebaseAuthWithGoogle(GoogleSignInAccount acct, Activity activity) {
    Log.d(AUTHCONTROLLER_TAG, "firebaseAuthWithGoogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(activity, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(AUTHCONTROLLER_TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state authListener will be notified and logic to handle the
                    // signed in user can be handled in the authListener.
                    if (!task.isSuccessful()) {
                        Log.w(AUTHCONTROLLER_TAG, "signInWithCredential", task.getException());
                    }
                }
            });
}

public void signOut() {
    mAuth.signOut();
}

void setAuthListener(AuthListener authListener) {
    this.authListener = authListener;
}

interface AuthListener {
    void onUserAuthenticated(FirebaseUser user);
}

虚拟位置 - &gt;的 USR /本地/ LIB / node_modules / @角/ CLI / node_modules /

然后使用以下命令创建新项目

npm install -g @angular/cli

了解有关cli check the wiki

的更多信息

答案 1 :(得分:0)

Angular CLI github

您将使用NPM安装angularCLI

npm install -g @angular/cli

注意-g参数它将全局安装cli,你可以在任何新项目中使用它。

CLI安装在NPM中。