angular2-babel-esnext-starter

授权协议 Readme
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 汪晨
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Angular Babel ESNext Starter

This repository shows development and testing techniques with Angular.The application is written in modern Javascript without Typescript.It can be ideal for those who are new to Angular and want to learn how things workand fiddle with Typescript later.

It is a basic CRUD application with authentication, similar to the news site jslive.com.You can see the list of links, add and edit them after you signed in.

If you're looking for Angular in Javascript without Gulp tasks and server side check out angular2-esnext-todomvc

If you're looking for Angular in Typescript check out angular2-webpack-starter

  • Modern Javascript implementation with classes, decorators.
  • Uses Babel to support decorators.
  • Same language constructs can be used as in Typescript (types will be stripped).
  • Bundles files with Webpack.
  • Automates tasks with Gulp.
  • Automatically rebundles and refreshes the browser on changes.
  • Unit testing with Karma and Jasmine.
  • Code coverage for original ES6 code.
  • Includes deployment to Heroku.
  • Linting with ESlint based on Airbnb's styleguide.
  • Layout and namings based on the official Angular 2 style guide

Concepts covered

  • Creating components with directives
  • Communication between child and parent components
  • Dependency injection for services
  • Change detection strategies
  • Using custom pipes in templates
  • Handling HTTP calls
  • Using observables
  • Routing
  • Authentication and restricting access to routes
  • Form handling
  • Using custom validators in forms
  • Internationalization with ngx-translate

Quick Start

git clone https://github.com/blacksonic/angular2-babel-esnext-starter.git
cd angular2-babel-esnext-starter
npm install

gulp serve

It bundles the application, copies the static files and starts the webserver with Nodemon.The transpiled application will have two separate ES5 compatible files: vendor.js for vendor libraries, boot.js for application logic.Server side changes restart the server, client side changes rebundle the Angular application and refresh the page with Livereload.

Note: The application needs at least Node 6+ installed.

Open it in your browser http://localhost:9000 and start coding your first Angular application in Javascript!

Testing

gulp test

Runs tests with Karma and Jasmine.Uses a single entry point (setup.spec.js), which includes all the *.spec.js files and runs the tests inside them.The test files can be found in the client/app folder next to the source files.

Because a clean bundling with Webpack can take multiple seconds, it is not ideal for development to run a clean test run every time.Instead it can run continuously on your development machine.

gulp test-dev

To get a good overview of testing possibilities within Angular read this article.

Workarounds

No more is needed, code can be written as in Typescript!

Read about the details how it is implemented in this article.

Authentication

It is implemented with the router's built-in lifecycle events.For a detailed explanation read this article.

Deployment (to Heroku)

It bundles the client application and copies static files and server files to the dist directory along with package.json.Then it can be commited to the desired location (for example Heroku).

gulp dist

cd dist
git init
git add -A .
git commit -m "Deploy #1" && echo Committed
git push -f git@heroku.com:angular2-es6-starter.git master
 相关资料
  • Angular ESNext TodoMVC TodoMVC application built with Angular in Javascript (ES6/ES7). Layout and namings based on the official Angular style guide. Concepts it covers Creating @Component with directi

  • esnext 是一个 JavaScript 库,可以将 ES6 草案规范语法转成今天的 JavaScript 语法。 例如: /*On the left is code written with new JavaScript features,and on the right is the console output, plus the same codere-written so it can

  • 更改历史 * 2018-1-7 高天阳 2.2.2图片改文字 * 2018-1-6 高天阳 格式化文档 * 2017-5-11 高天阳 初始化文档 1 简介、用途 1.1 简介 标准的制定者计划,以后每年发布一次标准,使用年份作为版本号。ES6是在2015年发布的,所以又称为ES2015。 但ES6其实多用于泛指ES5.1版本后的下一代JS标准,它涵盖在ES2015版本上

  • Babel 是编写下一代 JavaScript 的编译器。 ES2015 and beyond。Babel 默认使用一组 ES2015 语法转换器,允许你使用新的语法,无需等待浏览器支持。 JSX and React。Babel 内置支持 JSX,与  babel-sublime 包一起结合,将语法高亮功能带到一个新的高度。 Pluggable。Babel 支持用户插件。允许你插入强大的 Babe

  • 我已经安装了Babel7.5,这应该是理想的目标预置环境包,但不确定为什么它正在寻找“Babel-Preset-ES2015”。 你们能告诉我我犯了什么错误吗?下面是我的代码 package.json .babelrc 模块生成失败(来自./node_modules/babel-loader/lib/index.js): 错误:从“d:\shashank\projects\uploadutilit

  • Install npm install --save-dev @babel/types API anyTypeAnnotation t.anyTypeAnnotation() See also t.isAnyTypeAnnotation(node, opts) and t.assertAnyTypeAnnotation(node, opts). Aliases: Flow, FlowType,