I am new to AngularJs. I've worked on KnockoutJs which has MVVM methodology. You define your data in ViewModel and data-bind
it to the View. That way, you can create modular and single-purpose reusable controls that show any data based on the input to ViewModel. How to achieve it in AngularJs?
I read about scope
, which I feel is Angular's way of data binding between View and Controller. Inside Controller, whatever you assign to scope can be used in View.
However, how to give input to the Controller so that it can then process the input and place values in scopes which in turn will get displayed in View?
e.g. Let's say I want to make a Controller which takes a number as input, adds 1 to that number and puts in $scope.numberPlusOne
and then inside the view, I use {{numberPlusOne}}
to display that added number? How to achieve it, as it would be needed when we do nesting of Controllers, right?