Trying to make real-time edits to an element by triggering a function on ng-click using AngularJS.
My HTML code:
<div class="row question">{{questions.1.name}} <a href="" class="glyphicon glyphicon-pencil" ng-click="editQuestion(questions.1.name)"></a></div>
And here is the JavaScript:
function QuestionsMap($scope) {
$scope.questions = {
"1": {
"name": "Hello! Do you like to travel?",
"ID": "1",
"answer": {
"yes": {
"name": "Yes",
},
"no": {
"name": "No",
}
}
}
};
$scope.editQuestion = function (name) {
$scope.editing = $scope.questions[name];
};
}
What is missing in my implementation? Could the editQuestion function be incorrect?