src/app.js
- App entry point
index.html
- Main HTML file with imports and view entry point
src/app.js
- Add new heroes to the list
index.html
- Use
ng-repeat
to iterate over heroes list - Use
list-group
,list-group-item
bootstrap classes forul
andli
- Use
row
andcol-xs-6
bootstrap classes for hero item sections - Use
ng-repeat
to iterate overhero.affiliations
- Use
src/common/hero.js
src/app.js
- List
hero
as a dependency - Inject
heroService
intoAppController
- Use
heroService.getAll()
to get heroes list instead of hardcoding them
- List
src/common/hero.js
- Add a
heroes
variable (move theheroes
list fromapp.js
into a localvar
) - Return the
heroes
list in thegetAll
function
- Add a
index.html
- Nothing
src/routes/detail/detail.js
src/routes/detail/detail.tpl.html
src/routes/list/list.js
src/routes/list/list.tpl.html
src/app.js
- List
list
anddetail
as dependencies - Inject
$locationProvider
intoappConfig
- Call
$locationProvider.html5Mode(true)
inappConfig
- Set default route with
$routeProvider.otherwise('/')
- List
src/routes/list/list.js
- Use
$routeProvider.when('/', { ... })
to set '/' route to useListController
andsrc/routes/list/list.tpl.html
. See official docs - List
hero
as a dependency - Inject
$scope
andheroService
intoListController
- Set
$scope.hero = heroService.getAll()
- Use
src/routes/list/list.tpl.html
- Move list markup from
index.html
intolist.tpl.html
- Move list markup from
src/routes/detail/detail.js
- Use
$routeProvider.when('/detail/:id', { ... })
to set route to useDetailController
andsrc/routes/detail/detail.tpl.html
. See official docs - List
hero
as a dependency - Inject
$scope
,$routeParams
, andheroService
intoDetailController
- Set
$scope.heroId = parseInt($routeParams.id)
- Set
$scope.hero = heroService.get($scope.heroId)
- Use
src/routes/detail/detail.tpl.html
- Use
row
andcol-xs-6
classes to displayhero
properties - Use an
<a href="/">X</a>
tag to link back to list page - Use
ng-repeat
to iterate overhero.affiliations
- Use