ui-bootstrap-tpls and ui-bootstrap - javascript

In my application, I'm using the $modal directive of boostrap.ui. I'm also using the Bootstrap navbar with dropdown functionalities.
I'm having the problem that window.html cannot be found as described in this topic.
The problem in my case is that I have both a ui-boostrap.js file and a ui-bootstrap-tpls file included (v1.3.2)
According to this topic, I should only need the tpls file.
However, when I remove the boostrap.js file, all the other bootstrap functionalities for the dropdowns in my header are not working anymore.
Is it not possible to have both functionalities available?

UI-Bootstrap library is just an Angular wrapper for core Bootstrap library to remove the dependency of jQuery from the application. From the docs:
This repository contains a set of native AngularJS directives based on
Bootstrap's markup and CSS. As a result no dependency on jQuery or
Bootstrap's JavaScript is required.
ui-bootstrap-tpls.min.js or ui-bootstrap-tpls.js contains the default template for all the Javascript module shipped by Bootstrap i.e. why it's named -tpls.
The other file ui-bootstrap.min.js or ui-bootstrap.js does not include any templates for the Javascript modules/features.
So you should only include ui-bootstrap-tpls.min.js or ui-bootstrap-tpls.js if you are not planning to override any template.
The answer about why dropdown stopped working after removing bootstrap.js is that your HTML code is still using the jQuery version of Bootstrap but you should start using the ui-bootstrap version of those modules. Yes, it is possible to include both the Angular version of bootstrap (i.e. ui-bootstrap.min.js) and jQuery version of bootstrap (bootstrap.js) but it will be extra overhead on the app.
There is no need of jQuery in order to use Bootstrap's Javascript features if you have already included the ui-bootstrap library.

As explained by shashank, all bootstrap elements in bootstrap.js in converted to angular directives in ui-bootstrap-tpls.
If you simply replace the file it wont work as you expected.
If you changes to ui-bootstrap-tpls then you need to change the corresponding bootstrap components to angular ui directives.

Related

Disabled jquery on a div to fix conflicting issues with Vue.js

I'm working on a Drupal project that imports JQuery on all its pages. We started to use Vue.js by injecting it directly in the HTML pages for the development of dynamic components (not for a SPA).
The problem is that we have JQuery UI that conflicts with Vue.js. It will directly modify all the inputs of Vue.js by readapting their styles.
Is it possible to disable JQuery UI on a particular div, which would contain Vue.js? Without having to disable it on the whole page, because our header has a burger menu that uses JQuery UI.
We found a fix to correct this conflict between Vue.js and JQuery. This method will not completely disable JQuery on a given scope, but will disable a behavior that we were having trouble with.
$('select').selectmenu("destroy")
More about the method destroy here:
https://api.jqueryui.com/selectmenu/#method-destroy

Bootstrap modal in angualar2

I want to implement the Bootstrap modal in my angular2project. I tried with Bootstrap and jQuery, but my modal does not fade in. And I also tried an Angular dependency ng2-bs3-model, the same issue exists for that dependency also.
Is there any better way to implement the Bootstrap modal in Angular 2?
You could try native modal implementation from the ng-bootstrap project: https://ng-bootstrap.github.io/#/components/modal
The advantage is that those are native Angular directives which means that you wouldn't need to include jQuery or any other 3rd party JavaScript. The implementation of the modal service from https://ng-bootstrap.github.io/#/components/modal is very easy to use. There is a service to which you can pass a component to be used as modal's content. In most cases opening a modal is one-liner:
this.modalService.open(NgbdModalContent);
You can see a working example in action in this plunk: http://plnkr.co/edit/1epmosa7mqHiwF66oHEV?p=preview

Is there any way to use colorPicker in Angular WYSIWYG directive without using jQuery

When I remove the jquery refrence color picker is not working in WYSIWYG directive and in my project I should not use jQuery so is there any way to do this without using jquery? Or is there any other editor which has no jquery refrence?plunker with jquery ref
demo : http://so.lucafilosofi.com/is-there-any-way-to-use-colorpicker-in-angular-wysiwyg-directive-without-using-j/
The problem you have actually is not with colorPicker but with the wysiwyg module itself as stated in it's code comments:
Requires: Twitter-bootstrap, fontawesome, jquery, angularjs, bootstrap-color-picker
anyway, fortunately that module is using jquery only for bootstrap and tooltip plugin...
so i have:
replaced the original bootstrap with UI Bootstrap for angularjs
added ngSanitize module that provides functionality to sanitize HTML.
hacked the wysiwyg module to use the uib-tooltip directive
created a new ad-hoc directive for the contenteditable div
source plunker
hope this help. ;-)

Angular-boostrap popover requires Tooltip Module?

"Like the Bootstrap jQuery plugin, the popover requires the tooltip module."
Is this why I can't get my popover to work? What is the tooltip module, do I need to import something else? I imported bootstrap, angular-bootstrap, angular, and angular-animate. I still can't get something as simple as this to work:
<button uib-popover="test" popover-placement="top" popover-trigger="mouseenter">test</button>
The plunker example never imports a tooltip module?
https://angular-ui.github.io/bootstrap/#/popover
It's a part of Bootstrap JS framework. You can enable it by in including either tooltip.js or bootstrap.js files on your page.
https://getbootstrap.com/javascript/#tooltips
As for your issue, it's probably caused by some version conflict between the frameworks -- I had similar problem as yours and managed to get it working by updating the frameworks (AngularJS, bootstrap, ui-bootstrap) to their latest versions.
Also, the popovers don't work on disabled elements (using ng-disabled) (see https://github.com/angular-ui/bootstrap/issues/1025 )

AngularJs - How to not using jquery when calling bootstrap modal

I'm new in AngularJs. I try to make web with AngularJs and Bootstrap. when I call bootstrap modal I use this script :
$scope.here = function here(f) {
$('#smallModal').modal();
$('#contentin').html(f);
}
that code I call use ng-click=here('test')
in my header html i still use Jquery library. My question is , is it posiblle to unload jquery for call modal bootstrap who called with $ prefix. I don't want to use any plugin except AngularJs
If you want to make use of Bootstrap's modal, one option is to use Angular-UI's Bootstrap (if that isn't what you're already using), which puts Bootstrap components into Angular directives for you. Specifically, you would inject the $modal service into whatever module needs to control the modal. Here's an example of how to use the $modal service.
There are many ways of displaying model dialog out there. You can easily search with google.
btw, AngularJS use jQuery - or jQuery lite in the backend.

Categories

Resources