@@ -62,18 +62,19 @@ p._bind = function (def) {
62
62
if ( this . bind ) {
63
63
this . bind ( )
64
64
}
65
- if (
66
- this . update && this . _watcherExp &&
67
- ( ! this . isLiteral || this . _isDynamicLiteral ) &&
68
- ! this . _checkStatement ( )
69
- ) {
65
+ if ( this . _watcherExp &&
66
+ ( this . update || this . twoWay ) &&
67
+ ( ! this . isLiteral || this . _isDynamicLiteral ) &&
68
+ ! this . _checkStatement ( ) ) {
70
69
// wrapped updater for context
71
70
var dir = this
72
- var update = this . _update = function ( val , oldVal ) {
73
- if ( ! dir . _locked ) {
74
- dir . update ( val , oldVal )
75
- }
76
- }
71
+ var update = this . _update = this . update
72
+ ? function ( val , oldVal ) {
73
+ if ( ! dir . _locked ) {
74
+ dir . update ( val , oldVal )
75
+ }
76
+ }
77
+ : function ( ) { } // noop if no update is provided
77
78
// use raw expression as identifier because filters
78
79
// make them different watchers
79
80
var watcher = this . vm . _watchers [ this . raw ]
@@ -97,7 +98,7 @@ p._bind = function (def) {
97
98
this . _watcher = watcher
98
99
if ( this . _initValue != null ) {
99
100
watcher . set ( this . _initValue )
100
- } else {
101
+ } else if ( this . update ) {
101
102
this . update ( watcher . value )
102
103
}
103
104
}
0 commit comments