+
This is an advance starter project for Angular 2 apps based on AngularClass's angular2-webpack-starter and Nathan Walker's angular2-seed-advanced.
I would like to thank both for their great work and collaboration. Please refer to both projects' pages for extra documentation.
write_key
hereThe zen of multiple platforms. Chrome, Android and iPhone all running the same code. |
Programming Nirvana. Mac and Windows desktop both running the same code. |
frameworks
:
app
: your shared application architecture codecore
: foundation layer (decorators and low-level services)analytics
: analytics provided by Google Analytics
i18n
: internationalization featureselectron
: Electron specific codesample
: Just a sample module providing some components and servicestest
: test specific code providing conveniences to make testing your code easier and fastertslint
options like "no-unused-variable": true
as the api hangs off a plain Object
instead of globals
iit
or ddescribe
but didn't import those or vice versa, used iit
leaving an unused it
now in your tests? yeah, tslint
will be all over you :/unused
variable warnings altogether in tests since you are always using a valid key from the shorthand Object
Advice: If your project is intended to target a single platform (i.e, web only), then angular2-webpack-starter is likely more than suitable for your needs. However if your project goals are to target multiple platforms (web, native mobile and native desktop), with powerful out of the box library support and highly configurable/flexible testing options, then you might want to keep reading.
Additionally, this seed is intended to push a couple boundaries so if you see dependencies that are bleeding edge, this is intentional.
node v5.x.x or higher and npm 3 or higher.
To run the NativeScript app:
npm install -g nativescript
git clone --depth 1 https://github.com/JonnyBGod/angular2-webpack-advance-starter.git
cd angular2-seed-advanced
# install the project's dependencies
npm install or yarn install
# start the server
npm start
# use Hot Module Replacement
npm run start:hmr
# development
npm run build:dev
# production (jit)
npm run build:prod
# AoT
npm run build:aot
npm run server:dev:hmr
npm run watch
npm run test
npm run watch:test
# this will start a test server and launch Protractor
npm run e2e
# this will test both your JIT and AoT builds
npm run ci
npm run webdriver:update
npm run webdriver:start
npm run webdriver:start
# in another terminal
npm run e2e:live
npm run docs
npm run build:docker
Mac: npm run start:desktop
Windows: npm run start:desktop:windows
Mac: npm run build:desktop:mac
Windows: npm run build:desktop:windows
Linux: npm run build:desktop:linux
All: npm run build:desktop
src/assets/i18n/
[language code].json
(copy existing one and adapt the translation strings)src/client/app.config.json
availableLanguages
src/app/frameworks/i18n/components/lang-switcher.component.spec.ts
Please Note: The seed uses Angular's ChangeDetectionStrategy.OnPush
by default which requires some understanding of immutability and one-way data flows. Please check out the following resources to learn more:
If you experience issues with changes not occuring in your views, you can disable this by commenting out these lines. The seed uses OnPush
by default because it provides optimal performance and if you decide to turn it off while developing your application, you can always turn it back on when you're ready to refactor your data services to utilize OnPush
properly.
There’s actually only a few things to keep in mind when sharing code between web/mobile. The seed does take care of quite a few of those things but here’s a brief list:
OpaqueTokens
which is a fancy name for something quite simple. Learn more here. A great example of how to integrate 2 different plugins (1 for web, 1 for {N}) and share all the code exists in this wiki article: How to integrate Firebase across all platforms written by the awesome Scott Lowe.WindowService
provided by the seed instead. This includes usage of alert
, confirm
, etc. For example:If you were thinking about doing: alert('Something happened!');
, Don't.Instead inject WindowService
:
constructor(private win: WindowService) {}
public userAction() {
if (success) {
// do stuff
} else {
this.win.alert('Something happened!');
}
}
This ensures that when the same code is run in the {N} app, the native dialogs
module will be used.
The advice Nathan Walker's likes to give, and I fully support it, is:
Code with web mentality first. Then provide the native capability using Angular’s
{provide: SomeWebService, useClass: SomeNativeService }
during bootstrap.
There are some cases where you may want to use useValue
vs. useClass
, and other times may need to use useFactory
. Read the Angular docs here to learn more about which you may need for your use case.
NOTE: This should be done first before you start making any changes and building out your project. Not doing so will likely result in dificulty when trying to merge in upstream changes later.
npm run git.setup
- This will initialize git
as well as setup upstream
properly.git remote add origin ...your private repo...
npm run git.prepare
- This will prepare git to handle the mergenpm run git.merge
- This will fetch upstream and run the first merge (*Important)upstream
and your first commit) added.git add .; git commit -m'ready'
. Yes, you will be committing all those conflicts, which actually are not a problem in this 1 time case.git
setup and ready to develop your application as well as merge in upstream changes in the future.npm install
(and all other usage docs in this README
apply)framework
for your application in src/app/frameworks
to build your codebase out. Say your app is called AwesomeApp
, then create awesomeapp
and start building out all your components and services in there. Create other frameworks as you see fit to organize.i18n
, remove ng2-translate
as dependency root package.json
and nativescript/package.json
. Then remove any references to i18n
throughout.npm run git:merge:preview
- This will fetch upstream
and show you how the merge would looknpm run git:merge
- This will actually do the mergeYou can read more about syncing a fork here.
If you have any suggestions to this workflow, please post here.
Configuration files live in config/
we are currently using webpack, karma, and protractor for different stages of your application.
Use config/custom/
configuration files when possible to add your custom configurations or override our configurations. This will help you when updating upstream.
The following are some things that will make AoT compile fail.
Please see the CONTRIBUTING and CODE_OF_CONDUCT files for guidelines.
Advance 是一个纯 Swift 编写的框架,可为开发者提供强大的动画功能。只要一个简单API,就能实现复杂的动画效果。 示例代码: import Advanceclass MyClass { let center: Animatable<CGPoint> init() { ... center.changed.observe { (value) in // Do s
vue-advance vue-advance 中的vue2-multiple是基于webpack2.x实现的多页打包功能模版。 使用 在使用 vue-multiple 模版之前必须先安装 vue-clie npm install -g vue-clivue init zhaoqize/vue-advance my-project 运行模版 npm run dev 由于模版主要实现的是多页面打包配
学习完 第二章 之后,你对模板已经有了基本的认识 本章将讨论 Go 的组合特性,以及 建立一个通用的调用 模板的方法 本章的GitHub链接为: Source, Diff, Zip 匿名组合 匿名组合 其实是Go里的一个非常重要的特性,在 Go 的世界里没有继承,只有组合(当然还有接口)。组合其实可以实现部分的继承。 main.go type Post struct { User
此界面是Simple Zone Editor的高级版本,我们在前一章中已经介绍过。 我们可以在这里添加,编辑或删除各种类型的记录,分别是A, AAAA, CNAME (圆锥名称记录), SRV (服务记录), TXT (文本记录)。 我们还可以在此界面中配置记录的TTL (生存时间)。 TTL(生存时间)表示DNS服务器在丢弃信息之前可以缓存资源记录的持续时间。 重置区域文件 此选项会重置您在cP
问题内容: 我正在使用angular2和gulp开发一个节点应用程序。我编写了一个组件文件login.ts,如下所示: 我的bootstrap.ts文件是: 但是当我编译这些文件时,出现以下错误: 这是我的tsconfig.json: 我已经使用以下命令安装了angular2的类型: 请帮助纠正错误。 问题答案: @simon错误说的是输入错误。但是对于其他进口商品,我已经发布了此答案,可能对其他
Angular2 (Beta) -> Angular4 开发语言:ECMAScript6 的标准已经完成。浏览器可以支持模块、类、lambda 表达式、generator 等新特性。 开发模式:Web组件将很快实现。 移动化:针对移动优化,如:缓存预编译、触控支持。 ES6工具链 Angular2是面向未来的技术,浏览器需要支持ES6+,由于目前浏览器尚未实现ES6,需要使用垫片。 angular