@@ -494,6 +494,7 @@ angularWidget('option', function(){
494494 *
495495 * @param {string } src expression evaluating to URL.
496496 * @param {Scope= } [scope=new_child_scope] expression evaluating to angular.scope
497+ * @param {string= } onload Expression to evaluate when a new partial is loaded.
497498 *
498499 * @example
499500 * <select name="url">
@@ -521,7 +522,8 @@ angularWidget('option', function(){
521522angularWidget ( 'ng:include' , function ( element ) {
522523 var compiler = this ,
523524 srcExp = element . attr ( "src" ) ,
524- scopeExp = element . attr ( "scope" ) || '' ;
525+ scopeExp = element . attr ( "scope" ) || '' ,
526+ onloadExp = element [ 0 ] . getAttribute ( 'onload' ) || '' ; //workaround for jquery bug #7537
525527 if ( element [ 0 ] [ 'ng:compiled' ] ) {
526528 this . descend ( true ) ;
527529 this . directives ( true ) ;
@@ -546,13 +548,15 @@ angularWidget('ng:include', function(element){
546548 } ) ;
547549 this . $watch ( function ( ) { return changeCounter ; } , function ( ) {
548550 var src = this . $eval ( srcExp ) ,
549- useScope = this . $eval ( scopeExp ) ;
551+ useScope = this . $eval ( scopeExp ) ;
552+
550553 if ( src ) {
551554 xhr ( 'GET' , src , function ( code , response ) {
552555 element . html ( response ) ;
553556 childScope = useScope || createScope ( scope ) ;
554557 compiler . compile ( element ) ( element , childScope ) ;
555558 childScope . $init ( ) ;
559+ scope . $eval ( onloadExp ) ;
556560 } ) ;
557561 } else {
558562 childScope = null ;
0 commit comments