Note. I am NOT updating the ng1 application. I am trying to make the ng1 and ng2 application live side by side (or rather nested).
We have something like the following html showing how we are trying to use two structures on a page at once:
- Angular 1: The whole page is managed by Angular 1. But we used ng-non-bindable to tell the ng1 application to ignore the div in the middle of the page.
- Angular 2: Only the element in the middle of the page should be loaded as Angular 2.
<html ng-app="app">
<head></head>
<body ng-controller="appController">
<header>Angular 1 Stuff</header>
<div ng-non-bindable>
<ng2-app></ng2-app>
<script src="bundle.js"/>
</div>
<footer>Angular 1 Stuff</footer>
</body>
</html>
Run codeHide resultOur application works great when we run it ourselves, without trying to integrate into this page of the ng1 application.
, , require.
- ng1
requirejs - ng2 -
webpack ( typescript-loader)
requirejs webpack require, .
?
, : , Angular 1. / . . Angular 2 .