Coder Social home page Coder Social logo

f-angular-part2-homework's Introduction

AngularPart1

This project was generated with Angular CLI version 10.1.7.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Homework

Requirement 1

改造service从api获取数据

  1. 将StudentService上的getStudents和getStudent方法用HttpClient改造
  2. 修改StudentListComponent和StudentDetailComponent组件的Init钩子方法,改为订阅http返回的结果。
  3. 捕获getStudent的异常并

Requirement 2

改造app添加NgRx状态管理工具来维护数据

  1. 创建loadStudent和setStudent的ActionCreator。
  2. 创建StudentReducer,需要响应loadStudents和setStudents Action。
  3. 修改StudentListComponent和StudentDetailComponent组件,不注入Service改为注入Store,订阅Store上的selector来获取数据。
  4. StudentListComponent的Init钩子中dispatch出loadStudents Action。
  5. 创建LoadStudentEffect监听loadStudents Action,调用StudentService的getStudents方法从api获取数据,输出setStudents Action。
  6. 在AppModule中加载StoreModule和EffectsModule模块。

f-angular-part2-homework's People

Contributors

anqichen-ann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.