Sharing scope between controller & directive in AngularJS

后端 未结 2 392
天命终不由人
天命终不由人 2020-12-30 11:28

I\'ve created a directive to wrap a jQuery plugin, and I pass a config object for the plugin from the controller to the directive. (works)

In the config object is a

2条回答
  •  隐瞒了意图╮
    2020-12-30 12:31

    The changeDate event bound to the input seems to be set up to fire outside of the Angular framework. To show the paragraph, call $scope.$apply() after setting dateChanged to true. To hide the paragraph after the delay, you can use $apply() again inside the function passed to setTimeout, but you're likely to keep out of further trouble using Angular's $timeout() instead.

    Fiddle

提交回复
热议问题