mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 15:24:43 +00:00
chore(ng-include): update to work in ng-include|src mode
This commit is contained in:
parent
3e5377f4f3
commit
cce31d4c93
2 changed files with 3 additions and 3 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @scope
|
* @scope
|
||||||
*
|
*
|
||||||
* @param {string} src angular expression evaluating to URL. If the source is a string constant,
|
* @param {string} ng-include|src angular expression evaluating to URL. If the source is a string constant,
|
||||||
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
|
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
|
||||||
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
|
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
|
||||||
* instance of angular.module.ng.$rootScope.Scope to set the HTML fragment to.
|
* instance of angular.module.ng.$rootScope.Scope to set the HTML fragment to.
|
||||||
|
|
@ -78,7 +78,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
||||||
return {
|
return {
|
||||||
restrict: 'EA',
|
restrict: 'EA',
|
||||||
compile: function(element, attr) {
|
compile: function(element, attr) {
|
||||||
var srcExp = attr.src,
|
var srcExp = attr.ngInclude || attr.src,
|
||||||
scopeExp = attr.scope || '',
|
scopeExp = attr.scope || '',
|
||||||
onloadExp = attr.onload || '',
|
onloadExp = attr.onload || '',
|
||||||
autoScrollExp = attr.autoscroll;
|
autoScrollExp = attr.autoscroll;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ describe('ng-include', function() {
|
||||||
it('should remove previously included text if a falsy value is bound to src', inject(
|
it('should remove previously included text if a falsy value is bound to src', inject(
|
||||||
putIntoCache('myUrl', '{{name}}'),
|
putIntoCache('myUrl', '{{name}}'),
|
||||||
function($rootScope, $compile, $browser) {
|
function($rootScope, $compile, $browser) {
|
||||||
element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
|
element = jqLite('<div ng-include="url" scope="childScope"></div>');
|
||||||
element = $compile(element)($rootScope);
|
element = $compile(element)($rootScope);
|
||||||
$rootScope.childScope = $rootScope.$new();
|
$rootScope.childScope = $rootScope.$new();
|
||||||
$rootScope.childScope.name = 'igor';
|
$rootScope.childScope.name = 'igor';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue