martinrusev
6/9/2014 - 10:39 AM

Select2/Angular Integration

Select2/Angular Integration

"use strict";
var el;
var underscore = angular.module('underscore', []);
underscore.factory('_', function() {
	return window._;
});

var app = angular.module('DashboardApp', ['underscore'])
.controller('DashboardCtrl', function($scope){
	$scope.AddMetric = function(name) {
       console.log(el.select2('val'))
       
    };
	
})
.directive('dashboardDropdown', function($window) {
	return {
		restrict: 'A',
		scope: {},
		controller: ['$scope', '$element', '$attrs',
		function($scope, $element, $attrs) {
			
		}],
		link: function(scope, element, attrs) {
			el = jQuery(element);
			el.select2();

		} // link

	}; // return
});