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

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?

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.

Related

Wagtail alongside Django Rest Framework drf-yasg?

I am implementing a Wagtail powered blog within a larger (primarily DRF) driven app. I'm attempting to use drf-yasg for my documentation.
Since installing wagtail, the docs are now throwing
'Request' object has no attribute 'wagtailapi_router'
It looks to be related to the introspection that drf-yasg does, and all I can find about excluding views from drf-yasg is done at the code level. Being an installed module obviously I want to avoid that.
Has anyone got these 2 (3) components playing nicely together?
It's been a very long time since you asked this question, but as I found this while looking for an answer myself, I thought I might share what worked for me.
Note that I'm not using drf-yasg, but rather DRF's own schema generator. They do however have a lot in common.
The problem in my case was that the schema generator URL was defined like this:
path(
"schema/",
get_schema_view(title="My API Schema"),
name="openapi-schema",
),
What I needed to add was a patterns= argument that referenced my API specifically, leaving out the other non-API urls (like Wagtail):
path(
"v3/schema/",
get_schema_view(title="My API Schema", patterns=router.urls),
name="openapi-schema",
),
I hope that helps... someone :-D

Laravel Twilio integration "resolvable from the IoC container"

I want to use twilio API in laravel 4 and i have used https://github.com/aloha/laravel-twilio package and read the all the steps but i didn't get this point "And make these objects resolvable from the IoC container".
So please tell me how to make object using IoC container for twilio.
Thanks in advance.
Instructions screenshot
I am adding an answer to this old question because it came up as I was trying to Google the exact same issue OP was having when this question was asked.
I was also confused by the wording in the instructions for that library. The Laravel docs point out:
Almost all of your service container bindings will be registered within service providers...
Assuming this is how the Twilio library is built, if you look a few lines above the on you are quoting, it instructs the developer to "add a new item to the providers array". The two sections beneath that (one starting with "This will..." and the other starting with "And make...") are both explaining the benefits of adding that service provider.
In conclusion, all you should need to do is add that service provider to your app.php file, per the instructions on the GitHub page.

Validation and ComplexTypes

I have read BreezeJS documention about validation and ComplexTypes. To my knowledge, there should be no reason for that scenario to work.
We use breeze.directives.js. BreezeJS version is 1.4.14. In our application, Person-entity has property PhoneNumber which is ComplexType. Person-entity is binded to a view in AngularJS app. For validation we used the example from Code Camper SPA. Person-entity gets validated and zValidate works as expected. To our surprise PhoneNumber-complextype gets validated too , but validation errors dont show up. So it seems there's problem with zValidation and ComplexTypes.
Anyone know if it should work ? Or are we just missing something?
Note: DocCode or any other sample didn't include this scenario implemented.
zValidate was not written to support ComplexTypes. zValidate is part proof-of-concept and part invitation to the community to contribute. It demonstrates one way to expose Breeze validation to the UI, declaratively, with an Angular directive. We invite you to fork it and offer improvements or alternatives. We're eager to tell the world about your work :-)

Testing ViewModels in MVVMCorss

I have just started working with MVVMCross for a cross platform app and I am having a hard time figuring out how to test my ViewModels. I tried following the testing done in TwitterSearch and ran into problems. Specifically in the MockSetup.cs I found that in the latest version of MvvmCross there no longer seems to be a IMvxViewDispatcherProvider but that is ok because I think its functionality has been rolled up into the IMvxViewDispatcher. However, when actually setting up the dipatcher for my test cases there is no RequestNavigate method for the dispatcher anymore and I can not find an implementation of MvxShowViewModelRequest. So I can not actually get any tests for my ViewModels to work.
I also tried to follow the testing here http://slodge.blogspot.com/2012/10/testing-viewmodels-in-mvvmcross.html but again ran into issues with missing MvxOpenNetCfServiceProviderSetup.
So in summary, my issue has been getting a MockSetup working so that I can test my ViewModels. If I could just be pointed in the right direction on the dispatcher, I think that would help.
It looks like you are trying to test an mvvmcross v3 application using mvvmcross vnext objects.
The updated twitter search test for v3 is at https://github.com/slodge/MvvmCross-Tutorials/tree/master/Sample%20-%20TwitterSearch/TwitterSearch.Test
This test uses a single special mock object: https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20TwitterSearch/TwitterSearch.Test/Mocks/MockMvxViewDispatcher.cs
The role of this mock is just currently:
to provide a very simple main thread (it uses the current thread)
to provide simple storage for any navigation requests.
You can see it used in:
https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20TwitterSearch/TwitterSearch.Test/HomeViewModelTest.cs

How to impliment MVC Authorization when older system is in place and returns a string

I am not using any of asp.net Authentication in my code. It is handled by an outside library. I get back a success or failure from the function. So all the work is done for me.sCould I get some examples of how I would implement this in MVC3. I know a little, I have had 2 weeks experience.
Thanks.
AuthFunction("UserName", "password");
You need to implement your own MembershipProvider. The ValidateUser method will use AuthFunction method from your library.
This tutorial should be good. Just skip the repository things because those are already implemented by your library. Carefully check the configuration section at the bottom of the tutorial.

Resources