问题描述
我对AngularJS 2.0来说很新。当我阅读其快速入门指南和其他一些帖子时,有 import
这样的行:code> import {Component,View,bootstrap} from'angular2 / angular2';
我想知道哪里 angular2 / angular2
。我如何知道我应该导入的根目录(或结构)是什么?
如@Guenter所述, angular2 / angular2
不是任何路径 - 而是它是Angular2的预定义束。为此,我们已经在 index.html
文件之前已经导入了
system.js
。 / p>
如果您查看,您可以看到 System.register(angular2 / core,....
,并告诉 systemjs
做什么,你可以
由于Angular2不再是测试版, angular2 / angular2
不存在
现在,根据所有更新,导入列表在这里:
<$ p $来自'angular2 / core'的
import {bootstrap}从angular2 / core中导入{组件,视图,指令,输入,输出,注入,注入,提供} / browser';
import {CORE_DIRECTIVES,FORM_DIRECTIVES,NgClass,NgIf NgForm,Control,ControlGroup, FormBuilder,Validators} from'angular2 / common';来自'angular2 / router'的
import {RouteConfig,ROUTER_DIRECTIVES,ROUTER_PROVIDERS,Router,LocationStrategy,HashLocationStrategy};
import {Http,HTTP_PROVIDERS,RequestOptions,Headers,Request,RequestMethod} from'angular2 / http'
I am pretty new to AngularJS 2.0. When I read its quickstart guide and some other posts, there are import
lines like this:
import {Component, View, bootstrap} from 'angular2/angular2';
I am wondering where angular2/angular2
is. How do I know what the root directory (or structure) that I should import from is?
As mentioned by @Guenter, angular2/angular2
is not any path - rather, it is a predefined bundle of Angular2. For this we have already importedsystem.js
before our angular in the index.html
file.
If you look at the source code of Angular, you can see System.register("angular2/core", ....
and that tells systemjs
what to do. You can find out more here.
As Angular2 is no longer in beta, angular2/angular2
does not exist.
Now, according to all of the updates, the list of imports is here:
import {Component, View, Directive, Input, Output, Inject, Injectable, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgIf NgForm, Control, ControlGroup, FormBuilder, Validators} from 'angular2/common';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {Http, HTTP_PROVIDERS, RequestOptions, Headers, Request, RequestMethod} from 'angular2/http'
这篇关于Angular2如何导入其组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!