diff --git a/src/ng/compile.js b/src/ng/compile.js index 7b2dde884926..df0bc4749660 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -2119,7 +2119,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { forEach(dst, function(value, key) { if (key.charAt(0) != '$') { if (src[key] && src[key] !== value) { - value += (key === 'style' ? ';' : ' ') + src[key]; + var concatString = ' '; + if (key === 'style') { + concatString = ';'; + } + if (key === 'ngIf') { //if ngIf is merged both conditions need to be taken into account + concatString = ' && '; + } + value += concatString + src[key]; } dst.$set(key, value, true, srcAttr[key]); } diff --git a/test/ng/directive/ngIfSpec.js b/test/ng/directive/ngIfSpec.js index 9ee94c95b55b..ad809e46f0ae 100755 --- a/test/ng/directive/ngIfSpec.js +++ b/test/ng/directive/ngIfSpec.js @@ -212,6 +212,23 @@ describe('ngIf and transcludes', function() { }); }); + it('should allow using ngIf on the target element and on the root element of the directive template when used in a replace mode', function() { + module(function($compileProvider) { + var directive = $compileProvider.directive; + directive('example', valueFn({ + template: '