Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ng controller (not yet woring)
- Loading branch information
David Votrubec
committed
Feb 15, 2014
1 parent
dcafb4a
commit 18a63f3
Showing
4 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@NgController( | ||
selector: '[ship-control]', | ||
publishAs: 'ctrl') | ||
class SpaceShipController { | ||
|
||
List<Recipe> recipes; | ||
SpaceShipController() { | ||
recipes = _loadData(); | ||
} | ||
|
||
Recipe selectedRecipe; | ||
|
||
void selectRecipe(Recipe recipe) { | ||
selectedRecipe = recipe; | ||
} | ||
|
||
List<Recipe> _loadData() { | ||
return [ | ||
new Recipe('My Appetizer','Appetizers', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 1), | ||
new Recipe('My Salad','Salads', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 3), | ||
new Recipe('My Soup','Soups', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 4), | ||
new Recipe('My Main Dish','Main Dishes', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 2), | ||
new Recipe('My Side Dish','Side Dishes', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 3), | ||
new Recipe('My Awesome Dessert','Desserts', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 5), | ||
new Recipe('My So-So Dessert','Desserts', | ||
["Ingredient 1", "Ingredient 2"], | ||
"Some Directions", 3), | ||
]; | ||
} | ||
} | ||
|
||
class Recipe { | ||
String name; | ||
String category; | ||
List<String> ingredients; | ||
String directions; | ||
int rating; | ||
|
||
Recipe(this.name, this.category, this.ingredients, this.directions, | ||
this.rating); | ||
} | ||
|
||
class SpaceShipModule extends Module { | ||
SpaceShipModule() { | ||
type(SpaceShipController); | ||
} | ||
} | ||
|
||
void main() { | ||
ngBootstrap(module: new MyAppModule()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters