aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets.js7
-rw-r--r--test/widgetsSpec.js19
2 files changed, 2 insertions, 24 deletions
diff --git a/src/widgets.js b/src/widgets.js
index 1ab8a2c9..4585629a 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -635,12 +635,7 @@ angularWidget('ng:include', function(element){
if (src) {
xhr('GET', src, function(code, response){
element.html(response);
- if (useScope) {
- childScope = useScope;
- } else {
- childScope = createScope(scope);
- scope.$onEval(childScope.$eval);
- }
+ childScope = useScope || createScope(scope);
compiler.compile(element)(element, childScope);
childScope.$init();
scope.$eval(onloadExp);
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index 6ec056ca..27c5cb82 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -609,24 +609,7 @@ describe("widget", function(){
});
describe('ng:include', function(){
- it('should include on external file and create a new child scope', function() {
- var element = jqLite('<ng:include src="url"></ng:include>');
- var scope = angular.compile(element);
- scope.counter = 0;
- scope.url = 'myUrl';
- scope.$service('$xhr.cache').data.myUrl = {value:'{{counter = counter + 1}}'};
- scope.$init();
- scope.$service('$browser').defer.flush();
- expect(element.text()).toEqual('2');
-
- //should also propagate evals to the child scope
- scope.$eval();
- expect(element.text()).toEqual('3');
-
- dealoc(scope);
- });
-
- it('should include on external file and use an existing child scope', function() {
+ it('should include on external file', function() {
var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
var scope = angular.compile(element);
scope.childScope = createScope();