Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from mohbasheer/bug-fix
Browse files Browse the repository at this point in the history
Fixed: Chip scope isn't accessible from template if model is instantiated as empty array (Angular 1.5+)
  • Loading branch information
mohbasheer committed May 2, 2016
2 parents 66fa541 + 4e83843 commit ed2c6a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
7 changes: 5 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Mohammed Basheer"
],
"description": "Angular-Chips is the angular based component. You can use it to add dynamic chips",
"main": "./dist/angular-chips.min.js",
"main": "./dist/angular-chips.js",
"keywords": [
"angular",
"chips",
Expand All @@ -33,6 +33,9 @@
"angular-mocks": "1.4.8"
},
"dependencies": {
"angular": "~1.4.8"
"angular": "v1.5.5"
},
"resolutions": {
"angular": "v1.5.5"
}
}
6 changes: 5 additions & 1 deletion dist/angular-chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@

/*Extract the chip-tmpl and compile inside the chips directive scope*/
var rootDiv = angular.element('<div></div>');
var tmpl = iElement.find('chip-tmpl').remove();
var tmplStr = iElement.html();
tmplStr = tmplStr.substr(tmplStr.indexOf('<chip-tmpl'),tmplStr.indexOf('</chip-tmpl>')-('</chip-tmpl>').length);
iElement.find('chip-tmpl').remove();
var tmpl = angular.element(tmplStr);
var chipTextNode, chipBindedData, chipBindedDataSuffix;
tmpl.attr('ng-repeat', 'chip in chips.list track by $index');
tmpl.attr('ng-class', '{\'chip-failed\':chip.isFailed}')
Expand Down Expand Up @@ -240,6 +243,7 @@
template: '<div ng-transclude></div>'
}


};
/* <chip-tmpl> tag is mandatory added validation to confirm that*/
function validation(element) {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-chips.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/js/directives/chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@

/*Extract the chip-tmpl and compile inside the chips directive scope*/
var rootDiv = angular.element('<div></div>');
var tmpl = iElement.find('chip-tmpl').remove();
var tmplStr = iElement.html();
tmplStr = tmplStr.substr(tmplStr.indexOf('<chip-tmpl'),tmplStr.indexOf('</chip-tmpl>')-('</chip-tmpl>').length);
iElement.find('chip-tmpl').remove();
var tmpl = angular.element(tmplStr);
var chipTextNode, chipBindedData, chipBindedDataSuffix;
tmpl.attr('ng-repeat', 'chip in chips.list track by $index');
tmpl.attr('ng-class', '{\'chip-failed\':chip.isFailed}')
Expand Down Expand Up @@ -237,6 +240,7 @@
template: '<div ng-transclude></div>'
}


};
/* <chip-tmpl> tag is mandatory added validation to confirm that*/
function validation(element) {
Expand Down

0 comments on commit ed2c6a6

Please sign in to comment.