UI sortable for Select Item in Angular - angularjs

Below is my code,which I have tried
UI-sortable option is not working in this line
<select ng-model="selectedItem" ng-options="i.items as i.items for i in curItem" ui-sortable="sortableOptions"ng-init="selectedItem=curItem[0].items"></select>

ui-sortable library should import in the top of the application Controller.

Related

AngularUI Bootstrap: Parse HTML in carousel text

I'm trying to implement an Angular UI Bootstrap Carousel and have HTML in the texts. Thought I could use something like
text: $sce.trustAsHtml('Nice image <br />test')
but apparently that doesn't work and I've no clue why.
Plunkr: https://plnkr.co/edit/9PvaS8SoRmN1o52wiAf8?p=preview (fork of the offical example from the docs).
Use ng-bind-html directive to display html content on view
<p ng-bind-html="slide.text"></p>
Demo Plunkr

Can't make ng properties work in Angular 2

I'm using Angular 2 RC1 and I'm trying to use ngFor. I've imported import {Component, Input} from 'angular2/core'; and I know angular is working (I've tried to display a variable <div>{{ myVar }}</div> and it works)
I keep getting Can't bind to 'ngFor' since it isn't a known native property when doing:
<div *ngFor="let item of list">{{item}}</div>.
I've tried to import import {NgFor} from 'angular2/common'; and added it to my directives with no success.
The litterature online is confusing as it seems the Angular team has changed between beta versions and RC...
You are importing from 'angular2/core' instead of '#angular/core', so you have to use '#' instead 'let':
<li *ngFor="#item of list">
{{ item }}
</li>

Angular Select Tag with Bootstrap Dropdown Styling

I need to create custom styling for a select dropdown (including the options). The more I've dug into this, the more I've realized that styling options is quite difficult.
I'm currently using Bootstrap's dropdown and it works great, except for the fact that I have to use a function to assign a value.
This is how I am currently using a 'custom select dropdown':
<div class="form-element-container">
<div class="drop-down dropdown-toggle">
<label for="chooseAdvisor"></label>
<div>
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">{{mySelection}}</button>
<ul class="dropdown-menu">
<li ng-repeat="option in options">{{option}}</li>
</ul>
</div>
</div>
</div>
You can see that on click, I have to manually set the option in my controller rather than it being directly bound to my model. Is there any way that I can use Bootstrap's dropdown styling with angular's select tag?
I would love to be able to use my options repeater with 'track by', etc:
<select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
You can try it:
https://angular-ui.github.io/bootstrap/#/dropdown
Just a suggestion, I've not tested it yet.
Update answer:
I think you can instead of angular module : acute-select
https://github.com/john-oc/acute-select
Demo : http://john-oc.github.io/

Drag and drop row on KendoUI Grid with AngularJs

How can I make a row in a KendoUI Grid draggable with AngularJs?
The documentation says you have to initialize the draggable component with a filter ie "tbody > tr", but I don't understand how to apply the kendo-draggable directive on just the rows.
This is how I initialize kendo-grid:
<div
kendo-grid
k-options="activityGridOptions"
k-rebind="activityGridOptions"
></div>
The solution is to define a rowTemplate and altRowTemplate on the config object and adding a template inside the html like so:
<!-- Grid row template -->
<script type="text/x-kendo-template" id="grid-row-template">
<tr data-uid="#= uid #" draggable draggable-data="dataItem" draggable-type="'planner.activity'" ng-class="{'current-item': currentActivityId == dataItem.SyncTableUniqueId}" ng-click="setCurrentActivity(dataItem)">
<td>{{dataItem.AvtaleNr}}.{{dataItem.VareLøpenummer}}</td>
<td>
{{dataItem.Date| moment:'ll'}} {{dataItem.Time| moment:'HH:mm':'HH:mm:ss'}}
</td>
<td>{{dataItem.FirstName}}</td>
</tr>
</script>
As you might notice, I am using a non-kendo draggable directive. The rowTemplate and altRowTemplate is assigned inside my controller:
$scope.activityGridOptions = {
dataSource: $scope.gridDataSource,
// ...
rowTemplate: kendo.template($("#grid-row-template").html()),
altRowTemplate: kendo.template($("#grid-row-template").html())
};
In addition to the answer above, you can try to use this angular directive:
https://github.com/neoziro/angular-draganddrop

ng-if without breaking stylesheet?

Is there a way to use an ng-if directive without adding a containing element? I'm playing around with dynamic menu items placed by the current view controller and want to handle a dropdown type and non dropdown type, however the ng-if has to be in some kind of element which breaks the bootstrap css.
Here's an example of what I'm trying to do:
<li ng-repeat="item in dynNavList">
<div ng-if="item.dd" ><!--There will be more stuff in here-->
Dropdown test {{item.title}}
</div>
<span ng-if="!item.dd">
NoDropDown {{item.title}}
</span>
</li>
Any nav item created in that html above doesn't style correctly in the navbar because it's inside a div or span element so the css doesn't apply.
I do not want to modify the bootstrap css to get this working and I'm trying to avoid writing any custom directives if possible.
Any suggestions?
ng-if directly on the anchor is fine, demo.

Resources