mirror of
https://github.com/Raghu-Ch/TurtleFactsQuiz.git
synced 2026-02-13 20:43:02 -05:00
dependency injection in angular /factories #services
This commit is contained in:
@@ -4,14 +4,16 @@
|
||||
.module("turtleFacts")
|
||||
.controller("listCtrl", ListController);
|
||||
|
||||
function ListController () {
|
||||
ListController.$inject = ['quizMetrics'];
|
||||
|
||||
function ListController (quizMetrics) {
|
||||
// List controller logic
|
||||
var vm = this;
|
||||
|
||||
vm.quizMetrics = quizMetrics;
|
||||
vm.data = turtlesData;
|
||||
vm.activeTurtle = {}; // will be used in the view to hold the data of currently active turtle
|
||||
vm.search = ""; // Adding the Search property to be used in the ng-model
|
||||
vm.quizActive = false;
|
||||
vm.changeActiveTurtle = changeActiveTurtle;
|
||||
vm.activateQuiz = activateQuiz;
|
||||
|
||||
@@ -20,7 +22,7 @@
|
||||
}
|
||||
|
||||
function activateQuiz () {
|
||||
vm.quizActive = true;
|
||||
quizMetrics.changeState(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user