@@ -133,17 +133,7 @@ var ngInitDirective = valueFn({
133
133
var ngControllerDirective = [ '$controller' , '$window' , function ( $controller , $window ) {
134
134
return {
135
135
scope : true ,
136
- compile : function ( ) {
137
- return {
138
- pre : function ( scope , element , attr ) {
139
- var expression = attr . ngController ,
140
- Controller = getter ( scope , expression , true ) || getter ( $window , expression , true ) ;
141
-
142
- assertArgFn ( Controller , expression ) ;
143
- $controller ( Controller , scope ) ;
144
- }
145
- } ;
146
- }
136
+ controller : '@'
147
137
}
148
138
} ] ;
149
139
@@ -264,6 +254,7 @@ var ngBindHtmlDirective = ['$sanitize', function($sanitize) {
264
254
var ngBindTemplateDirective = [ '$interpolate' , function ( $interpolate ) {
265
255
return function ( scope , element , attr ) {
266
256
var interpolateFn = $interpolate ( attr . ngBindTemplate ) ;
257
+ var interpolateFn = $interpolate ( element . attr ( attr . $attr . ngBindTemplate ) ) ;
267
258
element . addClass ( 'ng-binding' ) . data ( '$binding' , interpolateFn ) ;
268
259
scope . $watch ( interpolateFn , function ( value ) {
269
260
element . text ( value ) ;
@@ -921,3 +912,59 @@ function ngAttributeAliasDirective(propName, attrName) {
921
912
var ngAttributeAliasDirectives = { } ;
922
913
forEach ( BOOLEAN_ATTR , ngAttributeAliasDirective ) ;
923
914
ngAttributeAliasDirective ( null , 'src' ) ;
915
+
916
+ /**
917
+ * @ngdoc directive
918
+ * @name angular.module.ng.$compileProvider.directive.ng:transclude
919
+ *
920
+ * @description
921
+ * Insert the transcluded DOM here.
922
+ *
923
+ * @element ANY
924
+ *
925
+ * @example
926
+ <doc:example module="transclude">
927
+ <doc:source>
928
+ <script>
929
+ function Ctrl($scope) {
930
+ $scope.title = 'Lorem Ipsum';
931
+ $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
932
+ }
933
+
934
+ angular.module('transclude', [])
935
+ .directive('pane', function(){
936
+ return {
937
+ transclude: true,
938
+ scope: 'isolate',
939
+ locals: { title:'bind' },
940
+ template: '<div style="border: 1px solid black;">' +
941
+ '<div style="background-color: gray">{{title}}</div>' +
942
+ '<div ng-transclude></div>' +
943
+ '</div>'
944
+ };
945
+ });
946
+ </script>
947
+ <div ng:controller="Ctrl">
948
+ <input ng:model="title"><br>
949
+ <textarea ng:model="text"></textarea> <br/>
950
+ <pane title="{{title}}">{{text}}</pane>
951
+ </div>
952
+ </doc:source>
953
+ <doc:scenario>
954
+ it('should have transcluded', function() {
955
+ input('title').enter('TITLE');
956
+ input('text').enter('TEXT');
957
+ expect(binding('title')).toEqual('TITLE');
958
+ expect(binding('text')).toEqual('TEXT');
959
+ });
960
+ </doc:scenario>
961
+ </doc:example>
962
+ *
963
+ */
964
+ var ngTranscludeDirective = valueFn ( {
965
+ controller : [ '$transclude' , '$element' , function ( $transclude , $element ) {
966
+ $transclude ( function ( clone ) {
967
+ $element . append ( clone ) ;
968
+ } ) ;
969
+ } ]
970
+ } ) ;
0 commit comments