Playground for experimenting with some of the core features of Angular and integration with other software and services.
This project is no longer maintained and it's definitely out of date! Use at your own risk!
This setup is using:
PaaS:
Unit/E2E tests & format check:
CI/CD:
Tools:
Package management:
Make sure you have Node version v7.9
(or above) installed.
If you'd like to use Yarn, follow their instructions to install it on your platform,otherwise make sure at least NPM 5 is installed, you can check the version with npm --version
.
Follow the instructions for setting up the app:
git clone https://github.com/rolandjitsu/angular-lab.git
;yarn install
/npm install
;NOTE: Keep in mind that every package that was installed has to be invoked with either $(npm bin)/<package>
or node_modules/.bin/<package>
.Or if you want to avoid writing all of that every time:
.envrc
(just a file) with export PATH=$PATH:$PWD/node_modules/.bin
;direnv allow
at the root of the project where .envrc
resides.Now you can simply run <package>
.
If you'd like to use env variables, such as API keys, in the app, you can do so by importing from secrets
:
import {MY_SECRET} from 'secrets';
For the above to work, you need to:
MY_SECRET
to the .secrets
file (MY_SECRET
needs to be an env variable)src/typings.d.ts
:declare module "secrets" {
...
export const MY_SECRET: any;
}
npm run secrets:eject
The last command will generate a .secrets.js
module file containing all the secrets. This file is aliased to the secrets
path you use to import from (using the TS {paths}
compiler option).
NOTE: All the values will be strings, therefore, it's up to you to parse them as needed.
In order to use your own Firebase account for hosting the app, follow the instructions below:
$(npm bin)/firebase login:ci
to get an auth token (follow the steps you are given by the command) and export it export FIREBASE_TOKEN=<your Firebase token>
;$(npm bin)/firebase setup:web
to get it from {apiKey}
) and export it export FIREBASE_API_KEY=<your Firebase API key>
;angular-laboratory
with your own Firebase project id in .firebaserc
.Given that you have FIREBASE_TOKEN
and FIREBASE_API_KEY
exported as env var, you can deploy the app to your own Firebase account with:
# NOTE: This also generates a .secrets.js
npm run deploy
Or you can also use the following to set FIREBASE_TOKEN
/FIREBASE_API_KEY
and deploy:
FIREBASE_API_KEY=<your Firebase API key> FIREBASE_TOKEN=<your Firebase token> npm run deploy
If you plan on using this setup with your own projects and you wish to setup Travis CI,you must make sure of a few of things in order to have everything working properly on the CI:
FIREBASE_TOKEN
containing the token you got from $(npm bin)/firebase login:ci
:
travis encrypt FIREBASE_TOKEN=<your Firebase token>
, see docs to find out more about it;secure
key's value with the string generated from the previous step (it's right below FIREBASE_TOKEN
in .travis.yml
);FIREBASE_API_KEY
env variable:
travis encrypt FIREBASE_API_KEY=<your Firebase API key>
;secure
key's value with the string generated from the previous step (it's right below FIREBASE_API_KEY
in .travis.yml
);SAUCE_USERNAME
and SAUCE_ACCESS_KEY
:
SAUCE_USERNAME
with your own username (no need to encrypt);travis encrypt SAUCE_ACCESS_KEY=<your Saucelabs access key>
;secure
key's value with the string generated from the previous step (it's right below SAUCE_ACCESS_KEY
in .travis.yml
);webhooks
section from notifications
in .travis.yml
.If you don't want to deploy to Firebase on push skip the 1st and 2nd step in the instructions above and remove the following in .travis.yml
:
after_success: npm run deploy:ci
step;FIREBASE_TOKEN
env var;FIREBASE_API_KEY
env var.If you don't use Saucelabs, skip the 3nd step and remove the following in .travis.yml
;
sauce_connect
section from addons
;SAUCE_USERNAME
and SAUCE_ACCESS_KEY
env vars.Now, keep in mind that cloning this repo and continuing in the same project will give you some issues with Travis if you wish to set it up with your own account.So I suggest you start out with a clean project and start git from scratch (git init
),then copy over things from this project (obviously, do not include .git
- not visible on most UNIX base systems).
All you need to get started is npm start
(or npm start:prod
if you need to emulate a production environment).Now you should see the app running in the browser (might take a while when compiling the first time).
Below you can find a few of things to help understand how this setup works and how to make it easier when developing on this app.
Angular CLI is used to handle every aspect of the development of the app (e.g. building, testing, etc.).To get started, npm start
will start a static webserver, rerun builds on file changes (styles, scripts, etc.), and reload the browser after builds are done.
Unit tests run the same way, whenever there is a change the tests will rerun on the new code.For further info about tests read below.
Tests can be run selectively as it follows:
npm run lint
: runs tslint and checks all .ts
files according to the tslint.json
rules file;npm run lint:fix
: runs the above command and also tries to fix some of failures (see the rules with Has Fixer
flag);npm run test:continuous
: unit tests in Chrome headless; runs in watch mode (i.e. watches the source files for changes and re-runs tests when files are updated);npm run test
: unit tests in Chrome headless; runs in single run mode, meaning it will run once and it will not watch for file changes;npm run test:ci
: unit tests on the CI server; same as npm run test
, but it runs on Saucelabs browsers;npm run e2e
: e2e tests in Chrome headless without code watch or live reload;npm run e2e:ci
: e2e tests on the CI server, but on Saucelabs browsers.In case you need to build everything, run npm run build
(use npm run build:prod
if the build is for production).
To see what other commands Angular CLI has, run $(npm bin)/ng help
.Or take a look at the scripts
section in package.json
for project specific commands.
Deployments are handled by Travis CI.Pushing to master
will automatically deploy the app, given that all tests pass.
You can expect the app to run wherever Angular does, but check the matrix below to see where the project tests pass.
If you wish to contribute, please use the following guidelines:
npm run lint
/npm run lint:fix
to fix any TS warnings/errors before you check in anything:
[ci skip]
in commit messages to skip a build (e.g. when making docs changes)In the making of this simple app, I have made use of whatever resources I could find out there,thus, it's worth mentioning that the following projects have served as inspiration and help:
1.前言 前几天刚下定决心把毕业设计改造下,因为毕业设计算是我学习的基石,学习到的东西都尽可能的在这个平台上施展,锻炼自己.改造为前后端分离,前端使用angular2,后端只提供接口.便于以后的维护.那么就要学习agular2了. 这里就要说下个人观点了,安利一波:我认为每个程序员都应该有自己的一个项目,一个可以让你学习的东西能施展到上面的项目,可能该项目一开始很简单,但是随着你不断的学习,不断的
Angular: SPAS:单页应用程序 MVC: M(model):数据模型 V(view):视图 C(controller):控制器 控制器是用于协调数据模型和视图之间的关系,视图和模型都是相互独立的 为什么要使用MVC? 希望代码重用性更强,降低视图和数据模型的耦合度(粘连成都) Anguler: 模块:每一个部分都可单独成立一个模块 指令:ng开头的属性,有特殊意义的属性 服务:自定义服务
Angular 是一款十分流行且好用的 Web 前端框架,目前由 Google 维护。这个条目收录的是 Angular 2 及其后面的版本。由于官方已将 Angular 2 和之前的版本 Angular.js 分开维护(两者的 GitHub 地址和项目主页皆不相同),所以就有了这个页面。传送门:Angular.js 特性 跨平台 渐进式 Web 应用 借助现代化 Web 平台的力量,交付 app
即将到来的Angular 2框架是使用TypeScript开发的。 因此Angular和TypeScript一起使用非常简单方便。 Angular团队也在其文档里把TypeScript视为一等公民。 正因为这样,你总是可以在Angular 2官网(或Angular 2官网中文版)里查看到最新的结合使用Angular和TypeScript的参考文档。 在这里查看快速上手指南,现在就开始学习吧!
从头开始创建项目 lint你的代码 运行您的单元测试和端到端测试。 Angular 2 CLI目前只在TypeScript中生成框架,稍后还会有其他版本。
这小节内容是译者加的,因为我认为对于新手而言,学习一个框架是有成本的,特别是对于一个不算简单的技术来说,我希望这篇教程是对新手友好的,所以我首先要让你放心的将时间和精力投入到Angular2 中。那我们先不谈技术细节,先用数据说话。 这里我多说一句,最近看一些文章中谷歌趋势截图,大都没有把范围限定在“编程”上。图中可以看出Vue2非常少,所以在下面比较中不再单独统计。 教程数量 这里我选取的主要是
我们已经在Highcharts Configuration Syntax一章中看到了用于绘制图表的配置 。 下面给出角度计图表的示例。 配置 (Configurations) 现在让我们看一下所采取的其他配置/步骤。 chart.type 将图表类型配置为基于计量。 将类型设置为“规格”。 var chart = { type: 'guage' }; pane 此类型仅适用于极坐标图和角度
角度计图表用于绘制仪表/仪表类型图表。 在本节中,我们将讨论不同类型的角度计图表。 Sr.No. 图表类型和描述 1 角度计 角度表。 2 实心仪表 实心图表。 3 Clock 时钟。 4 带双轴的仪表 带双轴的仪表图。 5 VU表 VU表图表。
Highcharts Angular 是我们基于 Angular 框架封装的 Highcharts,可以很方便的在 Angular 开发环境中使用 Highcharts 创建交互性图表。 开发环境 确保您的 node, NPM, Angular 已经更新到最新版本。以下是经过测试和要求的版本: node 6.10.2+ npm 4.6.1+ @angular/cli 6.0.0+ Highchar
Angular Kickstart 是基于 AngularJS,GulpJS 和 Bower 的完整可伸缩构建系统,能加快 AngularJS 应用的开发。开发者只需关注代码的编写和测试,剩下的工作 AngularJS Kickstart 会帮忙完成。 特性: 5 个简单的任务:gulp serve,gulp serve:dist, gulp serve:tdd, gulp test:unit,