Skip to content

Commit 3ab718d

Browse files
OwenMelbztabacitu
authored andcommitted
[Optimisation] Manually bootstrapping angular apps (#154)
* manually bootstrapping angular apps * changelog
1 parent bf12f9c commit 3ab718d

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ All Notable changes to `Backpack CRUD` will be documented in this file
2020
- Nothing
2121

2222

23+
## [3.1.27] - 2016-10-x
24+
25+
### Fixed
26+
- 'table' field is properly encapsulated now;
27+
28+
2329
## [3.1.26] - 2016-09-30
2430

2531
### Fixed

src/resources/views/create.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@endsection
1515

1616
@section('content')
17-
<div class="row" ng-app="backPack">
17+
<div class="row">
1818
<div class="col-md-8 col-md-offset-2">
1919
<!-- Default box -->
2020
@if ($crud->hasAccess('list'))

src/resources/views/edit.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@endsection
1515

1616
@section('content')
17-
<div class="row" ng-app="backPack">
17+
<div class="row">
1818
<div class="col-md-8 col-md-offset-2">
1919
<!-- Default box -->
2020
@if ($crud->hasAccess('list'))

src/resources/views/fields/table.blade.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
2424
?>
25-
<div ng-controller="tableController" @include('crud::inc.field_wrapper_attributes') >
25+
<div ng-app="backPackTableApp" ng-controller="tableController" @include('crud::inc.field_wrapper_attributes') >
2626

2727
<label>{!! $field['label'] !!}</label>
2828

@@ -97,7 +97,7 @@
9797
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-sortable/0.14.3/sortable.min.js"></script>
9898
<script>
9999
100-
window.angularApp = window.angularApp || angular.module('backPack', ['ui.sortable'], function($interpolateProvider){
100+
window.angularApp = window.angularApp || angular.module('backPackTableApp', ['ui.sortable'], function($interpolateProvider){
101101
$interpolateProvider.startSymbol('<%');
102102
$interpolateProvider.endSymbol('%>');
103103
});
@@ -158,6 +158,16 @@
158158
}
159159
}
160160
});
161+
162+
angular.element(document).ready(function(){
163+
angular.forEach(angular.element('[ng-app]'), function(ctrl){
164+
var ctrlDom = angular.element(ctrl);
165+
if( !ctrlDom.hasClass('ng-scope') ){
166+
angular.bootstrap(ctrl, [ctrlDom.attr('ng-app')]);
167+
}
168+
});
169+
})
170+
161171
</script>
162172

163173
@endpush

0 commit comments

Comments
 (0)