In AngularJs if you had 2 lists and the second list depended on the values of the first list, it would automatically update. This could be done simply like this:
function toDoCtrl($scope) {
$scope.questions = [
{
active: true,
text: "Question 1",
answers: [
{
text: "Answer 1"
},
{
text: "Answer 1"
},
{
text: "Answer 3"
}
]
},
{
active: true,
text: "Question 2",
answers: [
{
text: "Answer 4"
},
{
text: "Answer 5"
},
{
text: "Answer 6"
}
]
}
];
$scope.setActive = function(question) {
question.active = !question.active;
};
}
Here it is on codepen:
https://codepen.io/r3plica/pen/dQzbvX?editors=1010#0
Now, I want to do the same thing using Angular 6, but it doesn't seem to work....
Here is the same thing using Angular:
https://stackblitz.com/edit/angular-qkxuly
Can someone help me make it work? Or give me some direction?
I have tried to do this myself using this link:
https://blog.thoughtram.io/angular/2016/10/13/two-way-data-binding-in-angular-2.html
But when I updated my stackblitz, it didn't work :(
https://stackblitz.com/edit/angular-jya414
I am going to try something else, because this didn't work. I am surprised no one has posted any possible solutions....I thought this would be a common thing