Difference between $reactive(this).attach($scope) and $scope.viewModel(this)
Asked Answered
F

1

8

In Angular "Todo App" tutorial on official meteor.com website in constructor there's:

$scope.viewModel(this);

In "Socially" tutorial on angular-meteor.com it looks like the very same thing is achieved by:

$reactive(this).attach($scope)

What's the difference?

Felizio answered 15/6, 2016 at 9:53 Comment(0)
M
1

Ok, so I did some research on the subject and here is what I found out.

Regarding $reactive(this).attach($scope):

"$reactive is a service that takes care of the reactivity of your Meteor data, and updates your AngularJS code."

"This service wraps context (can be used with this or $scope) - so you can use it with any context as you wish."

Read details about it here.

Regarding $scope.viewModel(this):

It looks like it is a package, a library:

"ViewModel is a view layer for Meteor. You can think of it as Angular, Knockout, Aurelia, Vue, etc. but without the boilerplate code required to make those work."

More information about it here.

Myer answered 27/7, 2016 at 12:50 Comment(1)
No, the tutorial in question doesn't use that viewmodel package.Valenzuela

© 2022 - 2024 — McMap. All rights reserved.