breeze: breeze.angular.js and breeze.savequeuing.js - breeze

I am using breeze with angular.
I have upgrade breeze to 1.4.11 and install breeze.angular.js.
The beginnings of a "breeze service" that tells Breeze to
use $q for its promises rather than Q.js
use $http for AJAX calls.
Consequently Breeze no longer requires the jQuery or the Q.js libraries
although non-Breeze code in your app may require either or both.
My problem is that I am still using breeze.savequeuing.js which requires window.Q.
Is there any official solution for this scenario or I have to manually change breeze.savequeuing.js?
It is simple. I can use HACK from angular.breeze.js breeze.Q is $q

We do not yet have an Angular version of breeze.savequeuing. It's on my backlog but way down the list as I try to discourage folks from getting in a situation where it is needed.
You are welcome to write one and contribute it. I recommend writing it as a real ng service rather than a simple Q-for-$q hack. If you like I'll look it over and give you my thoughts.
All the best.

As you mention "discouraging folks ..." I have to mention that the Breeze Todo Sample makes use of breeze.savequeuing.js:
<!-- 3rd party libraries -->
<script src="Scripts/angular.js"></script>
<script src="Scripts/jquery-1.8.3.min.js"></script>
<!-- Q is needed by breeze.savequeuing, not by Breeze-->
<script src="Scripts/q.min.js"></script>
<script src="Scripts/breeze.debug.js"></script>
<script src="Scripts/breeze.angular.js"></script>
<script src="Scripts/breeze.savequeuing.js"></script>
<script src="Scripts/toastr.js"></script>
Perhaps you may use this sample to show everyone to show how not to get into the situation where savequeuing.js is needed :-)

Related

Where to add ES6-Promise Script Tag In ASP.net MVC?

I'm using the sample here to embed a Power BI report into a web application.
The application compiles properly, but I'm getting an error involving Promises. I've tracked down the solution here. It seems that I need to add the following somewhere in my application:
<script src="https://npmcdn.com/es6-promise#3.2.1"></script>
However, I have absolutely no idea where this script tag should go. Any suggestions? Thank you.
The es6-promise library is a polyfill for Promises, mostly used in IE.
If you need it, you just need to put it anywhere in your <head> tag, preferably before your <script src='.../powerbi.js>.
For more info on es6-promise: https://github.com/stefanpenner/es6-promise

Distribution of polymer components

We have an application written entirely dart/polymer with quite a few polymer components. We use the custom tags in out index.html and compile to dart with pub build. The compile to javascript creates index.html of 24K lines. Original index.html is 150. The application works perfectly.
However we would like to distribute the code to third party sites so that they also can use the components with custom tags. Ideally by just linking to an already compiled script and simple using our custom tags in their pages.
I know this is possible without polymer. Question is does polymer support this? Is it possible to compile a polymer app and keep to a minimum amount of changes in the html file?
To reduce the problem to an example:
We would like our customers to be able to do some thing like this, without the use of dart sdk:
<head>
<script src="what_ever_required.js"></script>
<script src="our_application.js"></script>
</head>
<body>
<our-custom-tag></our-customer-tag>
<p>What ever else content</p>
</body>
Regards
That's currently not supported.
Currently an application that used Dart code needs to be compiled to JS as a whole at once. There is no way to build parts of a Dart application and compose an application from them later.
With the upcoming DDC (Dart Development Compiler) there might be a way to accomplish that. An experimental approach is https://pub.dartlang.org/packages/polymerize

How to customize jquery mobile build?

We would like to make jquerymobile lighter by removing modules we dont need.
Want to keep only some widgets, ui control decorations and touch event processing.
Would also like to use Zepto instead of the full jquery library...
Thank you!
jQM is now decoupled:
http://jquerymobile.com/blog/2011/08/03/jquery-mobile-beta-2-released/
Widgets: Now decoupled for flexible builds
We’ve wanted to decouple all our widgets from the page plugin for a
long time now and we’re happy to announce that we finally landed this
change. So what exactly does decoupled mean anyway? Well, the
individual widgets and utilities have always been broken out into
separate script files. However, the page plugin was responsible for
handling the auto-initialization all of the official plugins found in
the markup at page creation. This situation made it impossible to
remove plugins you don’t need without causing errors, and generally
set a bad precedent for future widget additions.
Now, pretty much all the UI widgets in the jQuery Mobile library are
completely decoupled so they can simply be deleted if not needed for a
particular project. This change allows you to dramatically reduce the
size of the library by only including the specific set of widgets or
features you need, in addition to the handful of required, core files.
While we still plan to do more decoupling and cleanup, the following
files are now decoupled and can safely be removed from the make file
before you do a custom build:
page header/content/footer
collapsible
controlgroup
fieldcontain
fixheaderfooter
button
checkboxradio
select
slider
textinput
links theming
listview
navbar
grid
We will work on a dependency map because a few widgets rely on others
to work. For example, the button markup plugin is called by many of
the widgets above, so it can only be excluded but if you’re not using
any of the widgets that depend on buttons.
We’re still working out our recommendations for mapping plugin
dependencies and decoupling things even further. Ultimately, this will
be surfaced in a download builder tool, so stay tuned!
You can head over to their GIT Repo and just download what you want:
https://github.com/jquery/jquery-mobile/tree/master/js
Not sure if you're just looking for event support, but this worked for me:
<script type="text/javascript" src="js/jquery.mobile.define.js"></script>
<script type="text/javascript" src="js/jquery.mobile.core.js"></script>
<script type="text/javascript" src="js/jquery.mobile.media.js"></script>
<script type="text/javascript" src="js/jquery.mobile.support.js"></script>
<script type="text/javascript" src="js/jquery.mobile.vmouse.js"></script>
<script type="text/javascript" src="js/jquery.mobile.event.js"></script>

Using a ScriptManager in razor?

Must be a simple question, but I cannot for the life of me figure out how to include a script manager in my view. <asp:ScriptManager /> doesn't work. Anyone know?
ScriptManager is a webforms specific construct, so if you are using MVC, you won't (and shouldn't) be able to use it. You can look at http://mvcscriptmanager.codeplex.com/ if you want something that ports some of the features of the scriptmanager to MVC.
I ran into a similar situation upgrading a project.
For "simple-ish" WCF Ajax services, I was able to get this work by adding:
<script src="#Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script type="text/javascript" src="#Url.Content("~/Services/SampleService.svc/jsdebug")"></script>
and then create my service object the old fashion way:
var dataService = new SampleService();
dataService.doBar(fooCallback,fooErrorMethod,null);
I haven't tested this is extensively, but Hey, isn't that why the word "kludge" became an official developer term.

How do I use MicrosoftMvcValidation.js without having to include MicrosoftAjax.js?

It looks like there's an issue in MVC 2 RC1 if you want to use jQuery.Validate but not the main Microsoft AJAX - which is 25kb even when gzipped.
According to Phil Haack you're supposed to be able to just include these scripts:
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript">
Unfortunately in some reorganization they did between Beta and RC - you also now need to include MicrosoftAjax.js which defines the Type prototype functions that are used by MicrosoftMvcJQueryValidation.js (the first line is Type.registerNamespace('Sys.Mvc'); which is defined in MicrosoftAjax.js)
Has anyone already extracted out the necessary code from MicrosoftAjax.js that is needed?
I'll have to do it sooner or later but if anyone has already done it that would help a lot!
Aha!
Looks like MicrosoftMvcValidation.js is NOT the file needed for jQuery.validate.
You need to use the very similarly named MicrosoftMvcJQueryValidation.js. This has no dependency on Microsoft.Ajax.js.
The latest version of MicrosoftMvcJQueryValidation.js is available in the futures download project. It isn't included in the normal download - hence my confusion.
Instead of jumping through hoops to get this working, you might want to look into letting Microsoft/Google serve the AJAX library for you. This would likely give you a speed advantage. And a good chance that the library will already exist on the client's machine.

Resources