Skip to content

Instantly share code, notes, and snippets.

@russiann
Created June 1, 2016 13:50
Show Gist options
  • Save russiann/c90fab727031ff7e1af73dedaa88a866 to your computer and use it in GitHub Desktop.
Save russiann/c90fab727031ff7e1af73dedaa88a866 to your computer and use it in GitHub Desktop.
compile
this.$rootScope.$on('f7:pageBeforeInit', (e, data) => {
const pageData = data.detail.pageData;
this.$F7Router.findRouteByUrl(pageData.url)
.then((route) => {
const config = route.config;
const navbar = data.detail.pageData.navbarInnerContainer;
const $scope = this.$rootScope.$new();
this.$controller(config.controller, {$scope}, null, config.controllerAs);
this.$timeout(() => {
var template = angular.element(pageData.container);
this.$compile(template)($scope);
if (navbar) {
var navbarElement = angular.element(navbar);
this.$compile(navbarElement)($scope);
}
});
})
.catch((err) => {
console.warn(err);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment