Last active
January 4, 2016 16:29
-
-
Save carlmw/8647287 to your computer and use it in GitHub Desktop.
Bootstrapping an Angular app in Shadow DOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('guestApp', []).controller('guestCtrl', function($scope) { | |
$scope.bar = "I'm a guest app, please be nice."; | |
}); | |
var el = document.createElement('x-editor'); | |
var shadowEl = el.webkitCreateShadowRoot(); | |
document.documentElement.appendChild(el); | |
shadowEl.innerHTML = '<div id="guest" ng-controller="guestCtrl">{{ bar }}</div>'; | |
angular.bootstrap(shadowEl, ['guestApp']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment