Skip to content

Commit 4f7e64a

Browse files
committed
Fix for stripped html on dropdown clear
Added a second conditional for dropdown used as navigation. Clear seems to strip the html out of the default text, reset does not. setting the dropdown model to false will now reset the dropdown programatically.
1 parent d0c4db2 commit 4f7e64a

File tree

6 files changed

+26
-23
lines changed

6 files changed

+26
-23
lines changed

angular-semantic-ui.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* semantic-ui-angular-jquery - 0.2.3
2+
* semantic-ui-angular-jquery - 0.2.4
33
* Angular Directives for Semantic UI
4-
*
4+
*
55
* https://github.com/ClickerMonkey/SemanticUI-Angular
66
* Released under the MIT license.
77
* Copyright 2017 Philip Diffenderfer and contributors.
@@ -228,34 +228,34 @@ angular.module('semantic-ui', [
228228

229229
}, true );
230230
},
231-
watcher: function (scope, expression, func, context, force, equals)
231+
watcher: function (scope, expression, func, context, force, equals)
232232
{
233233
var currentValue = angular.copy(scope[expression]);
234234

235-
scope.$watch(expression, function (updated)
235+
scope.$watch(expression, function (updated)
236236
{
237-
if (expression != 'model' || !angular.equals(currentValue, updated))
237+
if (expression != 'model' || !angular.equals(currentValue, updated))
238238
{
239239
func.call(context, updated);
240240
}
241241

242242
}, equals);
243243

244244
return {
245-
set: function (value)
245+
set: function (value)
246246
{
247-
if (scope[expression] != value || force)
247+
if (scope[expression] != value || force)
248248
{
249-
scope.$evalAsync(function ()
249+
scope.$evalAsync(function ()
250250
{
251251
scope[expression] = value;
252252
currentValue = angular.copy(scope[expression]);
253253
});
254254
}
255255
},
256-
update: function ()
256+
update: function ()
257257
{
258-
scope.$evalAsync(function ()
258+
scope.$evalAsync(function ()
259259
{
260260
});
261261
}
@@ -1287,9 +1287,11 @@ angular.module('semantic-ui', [
12871287
return function (scope, element, attributes) {
12881288
var applyValue = function (value) {
12891289
$timeout(function () {
1290-
if (value == null) {
1290+
if (value === null) {
12911291
element.dropdown('clear');
1292-
}
1292+
} else if(value === false){
1293+
element.dropdown('reset');
1294+
}
12931295
else if (element.dropdown('is multiple')) {
12941296
if (value instanceof Array) {
12951297
var translatedValue = [];

angular-semantic-ui.min.js

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular-semantic-ui.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "semantic-ui-angular-jquery",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"homepage": "https://github.com/ClickerMonkey/SemanticUI-Angular",
55
"authors": [
66
"Philip Diffenderfer <pdiffenderfer@gmail.com>"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "semantic-ui-angular-jquery",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Angular Directives for Semantic UI",
55
"author": "Philip Diffenderfer",
66
"license": "MIT",

src/dropdown/sm-dropdown.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@
162162
return function (scope, element, attributes) {
163163
var applyValue = function (value) {
164164
$timeout(function () {
165-
if (value == null) {
165+
if (value === null) {
166166
element.dropdown('clear');
167-
}
167+
} else if(value === false){
168+
element.dropdown('reset');
169+
}
168170
else if (element.dropdown('is multiple')) {
169171
if (value instanceof Array) {
170172
var translatedValue = [];

0 commit comments

Comments
 (0)