Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
fix(parseOptions): prevent error on empty collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Jan 19, 2014
1 parent 6a960e4 commit b113ca5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ module.exports = function (grunt) {
livereload: '<%= connect.options.livereload %>'
},
files: [
'{docs,<%= yo.src %>}/{,*/}{,docs/}*.html',
'{docs,.dev,<%= yo.src %>}/{,*/}{,docs/}*.html',
'{docs,.tmp,<%= yo.src %>}/{,*/}*.css',
'{docs,.tmp,<%= yo.src %>}/{,*/}*.js',
'{docs,.dev,.tmp,<%= yo.src %>}/{,*/}*.js',
'{docs,<%= yo.src %>}/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
Expand All @@ -86,6 +86,7 @@ module.exports = function (grunt) {
open: true,
base: [
'.tmp',
'.dev',
'docs',
'<%= yo.src %>'
]
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/parse-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ angular.module('mgcrea.ngStrap.helpers.parseOptions', [])
$parseOptions.valuesFn = function(scope, controller) {
return $q.when(valuesFn(scope, controller))
.then(function(values) {
$parseOptions.$values = parseValues(values);
$parseOptions.$values = values ? parseValues(values) : {};
return $parseOptions.$values;
});
};
Expand Down
7 changes: 7 additions & 0 deletions src/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ angular.module('mgcrea.ngStrap.select', ['mgcrea.ngStrap.tooltip', 'mgcrea.ngStr
if(angular.isDefined(attr[key])) options[key] = attr[key];
});

// if(element[0].nodeName.toLowerCase() === 'select') {
// var inputEl = element;
// inputEl.css('display', 'none');
// element = angular.element('<div class="btn btn-default"></div>');
// inputEl.after(element);
// }

// Build proper ngOptions
var parsedOptions = $parseOptions(attr.ngOptions);

Expand Down

0 comments on commit b113ca5

Please sign in to comment.