To start, you can add a file called “jsconfig.json” to the root of your project. You’ll need to add some compiler options, and set “allowSyntheticDefaultImports” to true.
This allows the VSCode precompiler to get type information about your variables and functions, presenting you with handy information when you hover over a symbol.
You can get type information about primitives, or even more complex objects.
And your es6 class declarations too!
The synthetic type inference is smart and can…
In Angular, it’s very easy for a directive to call into a controller. Working in the other direction – that is, calling a directive function from the controller – is not quite as intuitive. In this blog post, I’ll show you an easy way for your controllers to call functions defined in your directives.
First, calling a controller function from a directive is straightforward. You simply define a “callback” function in the controller and pass it to the directive (using the ‘&’ symbol in the isolated scope definition). It’s then trivial for the directive to invoke the function, which calls into the controller. To put things in .NET terms, this is akin to a user control (the directive) raising an event, which the user control’s host (the controller) can handle.
For example, you may want your directive to call your controller when the…
I’m currently working on a solution that exposes a BizTalk Orchestration as a RESTful webservice using WCF-WebHttp. Upon successful processing of the message, the service returns binary data for the client to download. However, if the processing fails, I wanted the service to return application/json data with an error message that would be suitable for consumers – I did not want Stack Traces or other internal details to be provided that could potentially be used by malicious consumers. Further, I wanted to ensure this information was sent in the same session.
Initially, I created a schema with my sanitized error information, set the Fault Operation Message Message Type to that schema, and enabled “Include exception details in faults.” While this did end up including my custom error message, it also included the extra information I was trying to avoid. It also…
While working on my most recent project using the Kendo UI Library I came across the following error when trying to inject html from a partial view into a Kendo UI Window.
SCRIPT5007: Unable to get property ‘top’ of undefined or null reference kendo.all.min.js, line 26 character 30328
This error would only occur in IE8 and not IE10, Chrome, or Mozilla.
var imgArrow = <asp:Literal runat=”server” Text=”<%$SPUrl:~sitecollection/
Style Library/Custom/images/stockup.png%>” />;
While I had originally thought this was a kludgey solution to begin with, it was getting the job done every single time.
However, a problem arose a few days after when I began refactoring the code. I had moved all of the js code from the master page itself into a separate js file, leaving only a static reference to the script on the master. The following code should be put within the ScriptManager control.
Let’s say you have a webpage where you need to call a service but cannot perform a post back. Recently I was on a client engagement where we needed to improve page performance by dynamically loading a navigation tree with a potential for several thousand links. We implemented a solution that would load each branch as the user clicked on the expanding icon by calling a web service via ajax and passing the required links back to the page and render them client side. This saved immensely on the load time for the page and improved the user experience
This kind of solution can be applied to several situations such as complex data processing, dynamic loading, or combining them all into a seamless form submission process that would clear the form on post backs.
We can accomplish this process simply by grabbing…
In recent years, the boom in mobile devices has caused more and more users to abandon their desktop internet browsers and opt for the ones sitting in their pocket. As a result, nearly 10% of 2011’s internet traffic was attributed to mobile device browsers. As more people are browsing the internet in this manner, it is important that currently standing websites, as well as newly developed ones, also include mobile friendly pages in their site.
Many companies have followed models put forth by sites such as www.amazon.com, with their widely known desktop interface for purchasing products. When the mobile markets started to pick up they developed a mobile site that operates in much the same way, but offers a friendlier user experience for those viewing it on a smartphone screen. This move to a mobile intuitive platform can generate an increase…