Skip to main content



Gradual migration of .net mvc application to Angular 2 - Part 2

Ok, so it wasn't quite as simple as I thought. Although it was possible as mentioned in the previous post to boot an Angular 2 root component within each individual page of an existing .Net MVC app there were two problems:

 On each MVC page the Angular 2 root component needs to have a different child component in order to instantiate just the component for the given page - so this component needs to be dynamically set at run time.It is not possible to bind an attribute to the Angular 2 root component in order to use @import to pass in the child component. Point number 2 was easily fixed by getting the raw element attribute on the root app component and binding this to the input of a nested <dynamic-component>.

Then the new dynamic component can take the name of the component passed in and insert this into its own template

This component needs to import all of the possible components that could be passed in as top level components (I have just included a couple of examples of …

Latest Posts

Gradual migration of .net mvc application to Angular 2 - Part 1

Custom scrollbar for variable height flex items

RxJs with jspm and Typescript

combineLatest Trap for RxJs newbies

Angular 1.* + Typescript + ES6 Modules + jspm

Getting Angular scope variable into Sigma.js and back out again

Angular module setup

Unit testing Angular JS controllers that use "Controller as" syntax

Domain Driven Design in Laravel 4 - Fourth & Final