Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 274
srokatonie Avatar asked Jun 15 '16 09:06

srokatonie


1 Answers

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.

like image 65
Setily Avatar answered Oct 30 '22 17:10

Setily