jQWidgets Forums
jQuery UI Widgets › Forums › Dialogs and Notifications › Tooltip, Notification, Popover › jqxNotification with AngularJS: Databinding does not work › Reply To: jqxNotification with AngularJS: Databinding does not work
Thank you Dimitar for the feedback and that you have already fixed the online example. As I see, you also removed the “jqx-data” attribute from the jqx-notification directive, which surly makes sense (I wondered about it).
However, I still have a question:
Why does you open the notification with
$scope.notificationSettings.apply('open');
Why does this work? I mean, notificationSettings does not have a function apply assigned in the assignment in the controller:
$scope.notificationSettings = {
width: "auto", position: "top-right", opacity: 0.9,
closeOnClick: true, autoClose: false, showCloseButton: true, template: "mail" }
Can you explain that? (Yes, I am newbie…)
For me, the logical way would be: Assign a jqx-instance attribute, then invoke the method open of this object. But this seems not to work; the notification is opened but always empty.
MyApp.controller("notificationController", function ($scope) {
$scope.notificationtext = 'notification...';
// jqy-notification instance will be point to $scope.notif later...
$scope.notif = {};
$scope.openNotification = function (text)
{
$scope.notificationtext = text;
$scope.notif.open();
};
$scope.notificationSettings = {
width: "auto",
position: "bottom-right",
opacity: 0.9,
browserBoundsOffset: 20,
closeOnClick: false,
autoClose: true,
autoCloseDelay: 5000,
showCloseButton: false,
template: "info"//, blink: true
}
});
HTML:
<div ng-controller="notificationController">
<button ng-click="openNotification('hello world!')">Open...</button>
<jqx-notification jqx-instance="notif" jqx-settings="notificationSettings">
<div>{{notificationtext}}</div>
</jqx-notification>
</div>
Thanks in advance!
badera