AngularJS Tabs generating dynamic content - angularjs

I am new to AngularJs and javascript. I have a text box in the dynamically generated angular js tabs. I dont want the value to refresh every time I click on the other tabs. Is static tabs the only option or is there a work around? Just an example fiddle.
Js Fiddle

for your input use a different ng-model for your 3 templates.
<input type="text" ng-model="myModel1">
so you will be able to change tabs and keeping input.

Related

Is it possible to create a tooltip of directive in AngularJS?

Hi is it possible to create a tooltip of which the content is an AngularJS directive? Meaning that the tooltip contains not only texts (like a normal tooltip), but some SVG graphs as well. The use case will be the same, say, the user mouses-over an element, and instead of showing some texts, it's now showing some graphs.
You can use angular-bootstrap popover directive with custom template. You can read here

tinyMCE in an angularjs modal dialog only works on the first popup

There is a modal box that is opened from the page multiple times. The tinyMCE control is initiated on the first popup but on subsequent popups, the textarea is not transformed.
I tried using a timer as suggested here stackoverflow/17825282 but got the same result.
Code on Plunker
From docs: https://github.com/angular-ui/ui-tinymce
Be sure not to set an id attribute.)
So just remove id:
<textarea ui-tinymce="" ng-model="tinymceModel">{{SectionTemplate.Preface}}</textarea>
http://plnkr.co/edit/Mv2fLWuKiVjEIy77XNF0?p=preview

Dynamic dropdown in angularjs

I am new to angular, i am having requirement like create dynamically a dropdown with 3 buttons(add,edit,delete) by clicking on a link(create drop down button). We can create a multiple dropdown by clicking on a link Add/delete button should show with dropdown by default. If click on add/delete should display edit and viceversa.
See angularjs directives https://docs.angularjs.org/guide/directive
For dynamic handling of DOM directive is the best
You can also check https://angular-ui.github.io/ for more features make with directive

Bootstrap3 + Angular with Select causes the drop down to cut off

I am trying to use the HTML Select tag along with AngularJs using the ng-options directive to create a drop down options menu. On top of this I am using Bootstrap 3. I also have ui-bootstrap imported into the project.
Everything works functionally but I have an odd issue where when a user opens the Select dropdown for the first time after visiting the page then the last option in the drop down menu is cut off as in this image:
Once the user selects something and selects the drop down again then everything displays properly.
Here is the code I am using:
<!-- Select -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectThemePark">Theme Park</label>
<div class="col-md-4">
<select id="selectThemePark" name="selectThemePark" class="form-control"
ng-model="tip.theme_park_id"
ng-options="themepark.id as themepark.theme_park_name for themepark in all_themeparks | orderBy:'+theme_park_name'">
</select>
</div>
</div>
I am not a web developer by trade so I'm not sure if there is something I am doing wrong with the HTML select tag or if there is a CSS quirk in Bootstrap 3 that I need to overwrite for the Select tag? Any pointers to what might be causing this behaviour?
I've had a time using bootstrap with angular around drop down menus. From what I have seen part of the issue is associated to the javascript interacting with the DOM once the page has rendered. Remember angular/js is applied after the DOM is rendered. The reason it is working after the click event is because the menu is refreshing and rebuilding the DOM to account for the injected items(options). This has been a huge issue for me with drop downs. One thing that I have done to correct this build my menus/navigation in an angular directive using angular transclude. This allows me to attach the menu at the time angular is initialized. You may want to give the transclude directive a look. There are a number of blogs and articles out there discussing this topic. Just search for bootstrap angular drop down transclude. There is also a SO question around drop downs not working in angular here. Hopefully this will help get you on the right track.

AngularStrap tabs load html fragment

I am currently working on an AngularJS project with Twitter Bootstrap, and am trying to shift my Bootstrap directives into Angular. I decided on AngularStrap as it provided support for Bootstrap-Select (which I wasn't sure was the same for AngularUI). The tabs example only covered static html though. Is there any way via AngularStrap or AngularJS to load html fragments dynamically, so that it is only called when the tab is clicked? My html fragments need to execute javascript as well.
My reason for doing so is two-fold. First is that each tab contains quite a lot of content, and I do not wish to load all the tabs at once, which will slow down the loading. The second reason is that I prefer a more modular approach to my source code and not put everything on the same html file.
You can use the ng-include directive to load html fragments.
Using the AngularStrap Tab's example you can switch out the static content with the url to retrieve the html fragment. Here is an example based on the AngularStrap Tab example with these key changes:
1) $scope.tabs now has a page property instead of content pointing to either template1.html, template2.html, or template3.html.
$scope.tabs = [
{title:'Home', page: 'template1.html'},
{title:'Profile', page: 'template2.html'},
{title:'About', page: 'template3.html'}
];
2) An ng-include is added to display the currently selected tab's page.
<div ng-include src="tabs[tabs.activeTab].page"></div>
Note: I have the ng-include outside of the ng-repeat so each tab's page contents won't be loaded (even if not displayed).

Resources