Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinisCruz/986e37c98a2bedeff441 to your computer and use it in GitHub Desktop.
Save DinisCruz/986e37c98a2bedeff441 to your computer and use it in GitHub Desktop.
XSS in Angular Directive
extends index.jade
append head
base(href='/angular/component/')
script.
angular.module('TM_App') //disable routing
.config(
function($stateProvider, $urlRouterProvider, $locationProvider)
{
$urlRouterProvider.deferIntercept();
});
append body
show_View
angular.module('TM_App')
.directive 'showView', ($compile,$location)->
return {
link: ($scope,element)->
viewName = $location.$$path.substring(1)
html = "<#{viewName}/>"
compiled = $compile(html);
content = compiled($scope)
element.append(content)
}
angular.module('TM_App')
.directive 'showComponent', ($compile,$location)->
return {
link: ($scope,element)->
component_Name = $location.$$path.substring(1)
component = document.createElement(component_Name)
element.append $compile(component)($scope)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment