Bootstrap alert in a fixed floating div at the top of page
Just wrap your inner message inside a div on which you apply your padding : http://jsfiddle.net/Ez9C4/
<div id="message">
<div style="padding: 5px;">
<div id="inner-message" class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
test error message
</div>
</div>
</div>
Drop down alert always top of screen - AngularJS
I think in a nutshell the 'AngularJS' way would involve:
- creating a notification service with an interface for publishing and subscribing to events
- creating a directive that subscribes to the notification service and handles rendering the markup for the notifications; and you roll your own using Angular's jqLite or jQuery, or wrap your directive around a jQuery notification plugin, like Toastr, then place the directive on your layout
I prototyped a working concept of what this would look like here. Obviously it's primitive. Besides styling the 'notifications', there's work to handle queuing up notifications, etc. But I think that shows the basic concept.
Anyway, now you can inject the Notifications service into any components of your application and fire notifications at it.
Displaying bootstrap alert using angular2
Last night I didn't see it, it was probably too late. But your problem is not having the this
context in the inline function where you set saveSuccess
.
I'd suggest you use lambdas or "fat arrow function". Instead of
function(data) { ... }
you do
(data) => { ... }
This way the this
context will be preserved. Just use it wherever you need inline function and you will have no problems anymore! :)
Your code with the lambda function:
export class UserProfileComponent{
saveSuccess: boolean;
user: IUser;
saveUser(user:IUser) {
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.editUserForm = user;
this._http.post('api/user/'+this._current_user._id, JSON.stringify(this.editUserForm),{
headers: this.headers
})
.map((data: Response) => data.json) // <-- also add this to convert the json to an object
.subscribe((data) => { // <-- here use the lambda
// if the update is successful then set the value to true
// this is getting updated
if (data){
this.saveSuccess = true;
}
else{
this.saveSuccess = false;
}
});
}
}
Angular UI Modal with high z-index not on top
In order to make this work you must create a custom style for the z-index
property:
.zindex {
z-index: 99000 !important;
}
And apply the class to the modal window:
$scope.modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
windowClass: 'zindex'
});
Example: http://plnkr.co/edit/4T5Om0EcFAh5i4WUgNYi?p=preview
Drop down alert always top of screen - AngularJS
I think in a nutshell the 'AngularJS' way would involve:
- creating a notification service with an interface for publishing and subscribing to events
- creating a directive that subscribes to the notification service and handles rendering the markup for the notifications; and you roll your own using Angular's jqLite or jQuery, or wrap your directive around a jQuery notification plugin, like Toastr, then place the directive on your layout
I prototyped a working concept of what this would look like here. Obviously it's primitive. Besides styling the 'notifications', there's work to handle queuing up notifications, etc. But I think that shows the basic concept.
Anyway, now you can inject the Notifications service into any components of your application and fire notifications at it.
Related Topics
Div on Top of Div with Google Maps API
How to Have 2 Floating Divs Have The Same Height
Compact Arrangement of Divs in Two Directions
How to Vertically Align Label and Input in Bootstrap 3
How to Make a Div Adopt The Height of The Screen
Svg Circle File Stroke from Top in Anti Clockwise Direction on Windows
Change Div Order on Responsive Design
Why Is The Top Border of This Inline Element Not Displaying and Why Does Using Float Correct This
How to Style The Drop-Down Suggestions When Using HTML5 <Datalist>
Flexbox: Move Middle Element to The Next Line
What CSS Is Used by Browsers for Styling Invalid <Input Type="Email">S
Prevent Contenteditable Mode from Creating <Span> Tags
Using Section Element for Stylistic Layout and Wrappers
Which Way to Load a Huge Image (Canvas Vs Img Vs Background-Image)