This project was created to help represent a fundamental app written with Angular. The heroes and villains theme is used throughout the app.
by John Papa
Comparative apps can be found here with Svelte, React, and Vue
I love JavaScript and the Web! One of the most common questions I hear is "which framework is best?". I like to flip this around and ask you "which is best for you?". The best way to know this is to try it for yourself. I'll follow up with some articles on my experiences with these frameworks but in the meantime, please try it for yourself to gain your own experience with each.
Hosted in Azure
Clone this repository
git clone https://github.com/johnpapa/heroes-angular.git
cd heroes-angular
Install the npm packages
npm install
Run the app!
npm run quick
You can execute all of the UI tests by running the following steps
npm run cypress
Each of these apps contain:
Each of the apps written in the various frameworks/libraries has been designed to have similar features. While consistency is key, I want these apps to be comparable, yet done in an way authentic to each respective framework.
Each project represents heroes and villains. The user can list them and edit them.
Here is a list of those features:
Cypress.io makes it easy to run all three apps simultaneously in end to end tests, so you can watch the results while developing.
The goal of the project was to show how each framework can be designed to create the same app. Each uses their own specific techniques in a way that is tuned to each framework. However the one caveat I wanted to achieve was to make sure all of them look the same. While I could have used specific styling for each with scoped and styled components, I chose to create a single global styles file that they all share. This allowed me to provide the same look and feel, run the same cypress tests, and focus more on the HTML and JavaScript/TypeScript.
The app uses a JSON server for a backend by default. This allows you to run the code without needing any database engines or cloud accounts. Enjoy!
Thank you to Sarah Drasner, Brian Holt, Chris Noring, Craig Shoemaker, and Ward Bell for providing input and reviewing the code in some of the repos for the Angular, React, Svelte, and Vue apps:
就是把detail放在另一个组件里 ng generate component hero-detail 代码: heroes.component.ts import { Component, OnInit } from '@angular/core'; import { Hero } from '../hero'; @Component({ selector: 'app-heroes',
service的使用 ng generate service hero –module=app ng generate service message –module=app 代码: heroes.component.ts import { Component, OnInit } from '@angular/core'; import { Hero } from '../hero'; impo
route的使用 ng generate module app-routing –flat –module=app ng generate component dashboard 代码: heroes.component.ts import { Component, OnInit } from '@angular/core'; import { Hero } from '../hero'; im
1.导航 导航的第一步就是建立路由,路由使不同的组件之间相互关联了起来,一般来说在创建项目的时候他是会自动的询问你是否要创建路由,当然你如果忘了,也有生成路由的代码: ng generate module app-routing --flat --module=app 之后就会生成一个名为app-routing.moudule.ts的路由文件,这个文件的基础代码如下: import { NgMo
作为 官网的例子,以这个例子入门angular 新建一个项目: 然后 ng generate component heroes 代码: heroes.component.ts import { Component, OnInit } from '@angular/core'; import { Hero } from '../hero'; @Component({ selector: 'ap
(六)Angular4 英雄征途HeroConquest-服务 为了不再把相同的代码复制一遍又一遍,我们要创建一个单一的可复用的数据服务,并且把它注入到需要它的那些组件中。 使用单独的服务可以保持组件精简,使其集中精力为视图提供支持,并且,借助模拟(Mock)服务,可以更容易的对组件进行单元测试,在本节中将实现一个异步的数据请求机制Promise。承接上一节,在这一节中, 从组件中移除数据访问逻辑
Angular 英雄之旅 https://angular.cn/tutorial/toh-pt0 在组件中ts中直接定义 title 效果等于 data 展示 {{title}} 双向绑定 FormsModule [(ngModel)]=“title” 需要在 app.module.ts 自行添加 import { FormsModule } from ‘@angular/forms’ 模拟moc
judo-heroes A simple application built to showcase Universal JavaScript with Node.js and React. �� NEW VERSION AVAILABLE A new version of the codebase is available in a dedicated repository: https://g
Heroes of Newerth 是一款类似于“魔兽争霸3”中 DotA 场景的游戏,支持 Windows,Linux,Mac 操作系统。 HON 提供了比 Warcraft III DotA 场景更好的图形效果,并且支持 VoIP。 Heroes of Newerth 游戏特点: 自动选择水平相近的队友和对手 个人战绩统计 包括来自 DotA 和 Savage 2 世界的各种英雄 内嵌地图编辑