In this assignment you will build an Angular website. To learn Angular, please view and complete [[this]] tutorial, and focus on steps 0-9. The other steps and the tests at the bottom of each step are helpful and to master Angular you will need to learn these. However, for this module, you are not required to do these parts.
Now that you have finished the tutorial, we will make a coffee rating website!
To help you get started, download a skeleton to build an angular app on, called Angular-Seed. Go [[here]] and follow the instruction to download the seed, naming your project ‘coffees.’ Note: Although you can ignore a lot of these files (the node directory, the karma files, view1/view2, etc), by downloading the seed you can get around issues such as creating the server (this does it for you), and if you were going to use a backend, having node all set up for you is really nice.
Now that you’ve downloaded the seed, you will need to modify the following files: app.js, and index.html. Furthermore, you will add the following files: coffees.html, and reviews.html.
Creating the Site
Your site will need to use ‘ngRoute’ with two views on top of index.html. One view (coffees.html) will be a list of all coffees in the database, sorted by name. There should be a search box at the top to find a particular coffee. Each listing in the table should include a brand, a name, a location, and a link to see the reviews of that coffee. Here’s what it may look like before CSS:
Once you click the link, it should go to the second view (reviews.html). This should be another table, of all of the reviews for the coffee list.
Note: in order to keep a variable in a controller when you switch between two different views (instead of resetting the variables), use $rootScope as a dependency for that controller.
For example, if you want to keep the id of the selected coffee, making it $rootScope.selectedID in your controller will keep the value of that variable when you switch from coffees.html to reviews.html. Here’s what your reviews.html may look like before CSS:
At all times, there should be a button at the top (not in either view, but in the main page) that takes you home (coffees.html). In app.js, you will need to copy the following array into your controller:
This will be your “database,” as we are not going to use the “$http” dependency. The following is needed for the site:
Finally, use CSS and UI Bootstrap (view the reference [[here]] ), to make the site look pretty. Although you’re allowed to use whatever CSS/Bootstrap you want, UI Bootstrap makes things really easy. For example, using stars in the rating directives to display ratings instead of a number. Please follow the installation instructions carefully. The following should be in your index.html if you are using UI Bootstrap:
At the end, your coffee site should look something like this:
We will be grading the following aspects of your work. There are 100 points total.
Assignments must be demoed within 2 weeks of the assignment being due. We will grade late penalties based on Bitbucket submission time-stamps, so you are allowed to demo at TA office hours. However, after two weeks of not demoing, you will receive a zero for the assignment.
- You must save your repo as:
- (ie. Spring2025-Module3-John-Doe-201343)
- Completed Google Angular Tutorial steps 0-9 (5 points)
- Completed coffee web application (45 points)
- Index.html (5 points)
- Working button with back to home button at all times (3 points)
- Sets up angular correctly (2 points)
- App.js (10 points)
- Set up module ( 5 points)
- Controller (5 points)
- Have one controller for the project ( 2 points)
- Use scope and rootScope injections (3 points)
- Coffees.html (15 points):
- List of all coffees sorted by name (3 points)
- Search bar, working correctly (4 points)
- Has Name, Brand, Location, and review link all displayed in one table (3 points)
- Review link works, and takes you to another view (5 points)
- Reviews of correct coffee, and only correct coffee, are listed (10 points)
- All reviews are Listed ( 2 points)
- Rating, Comment, and commenter are listed in the same table. (3 points)
- Site looks good, intuitive, and professional ( 5 points)
- Index.html (5 points)