Last active
August 29, 2015 14:17
-
-
Save fastcodecoq/a8fd02211f970f100e31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="input-group"> | |
| <select required tabindex="2" chosen class="chosen-select form-control {{aclass}}" style="{{astyle}}" tabindex="{{tabIndex}}" ng-model="ngModel" ng-options="value.name for value in {{ngModel}} track by value._id"> | |
| </select> | |
| <div class="input-group-btn"> | |
| <button id="quickaddd" data-toggle="tooltip" data-placement="top" title="{{atitle}}" data-original-title="Crear uno nuevo" class="btn btn-primary"><i class="fa fa-plus-square-o"></i> | |
| </button> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function connectedField(){ | |
| function Ctrl($scope, $rootScope, API){ //API viene de los servicios | |
| // do the magic | |
| API | |
| [$scope.ngEntity]() //entity debe ser similar a su referencia en apiFactory, método que esta en el archivo controllers | |
| .get() | |
| .success(function(rs){ | |
| $scope[$scope.ngModel] = rs.data; | |
| console.log($scope[$scope.ngModel]) | |
| }); | |
| } | |
| function Link(scope, element, attrs){ | |
| //do something linking | |
| } | |
| return { | |
| restrict : 'AE', | |
| scope : | |
| { | |
| ngModel : '@', | |
| ngEntity : '@', | |
| aclass : '@', | |
| astyle : '@', | |
| tabindex : '@' | |
| }, | |
| templateUrl : 'views/connected_field.html', | |
| controller : Ctrl, | |
| link : Link | |
| } | |
| } | |
| angular | |
| .module('inspinia') | |
| .directive('ngConnected', connectedField); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ng-connected ng-model="miempresa" ng-entity="empresa"></ng-connected> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment