Jay
Jay

Reputation: 9477

Angularjs - Dropdown multiselect

I am trying to add an AngularJS multi select drop down by following http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

But I am not able to get it..

Here is my Plunker code

http://plnkr.co/edit/7EV9Fc?p=preview

HTML:-

<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
    <script src="https://github.com/dotansimha/angularjs-dropdown-multiselect/blob/master/src/angularjs-dropdown-multiselect.js"> </script>
    <script src="https://github.com/lodash/lodash/blob/master/dist/lodash.js"></script>
    <script src="script.js"></script>
  </head>

<body ng-app="jayApp" ng-controller='jayController'>

Drop down : 
    <div ng-dropdown-multiselect="" options="example1data" selected-model="example1model">

    </div>

</body>

</html>

Javascript

var jayApp = angular.module('jayApp',[]);

jayApp.controller('jayController', function($scope) {

    $scope.example1model = []; 
    $scope.example1data = [ {id: 1, label: "David"}, {id: 2, label: "Jhon"}, {id: 3, label: "Danny"}];
})

Upvotes: 2

Views: 10449

Answers (3)

Dois
Dois

Reputation: 804

var myApp = angular.module("yourAppName", [ "angularjs-dropdown-multiselect" ])

You need to register the module to your app.

Your path to the script was also wrong (as mentioned by another user).

I know this is 4 years too late, but hopefully this helps anyone else still using the ancient AngularJS.

Upvotes: 0

Amir
Amir

Reputation: 2267

The GitHub JS files you are referencing are not the actual JS files but the web page that shows the GitHub view of the JS file. You need to include the actual JS files.

Edit: Example:

https://github.com/dotansimha/angularjs-dropdown-multiselect/blob/master/src/angularjs-dropdown-multiselect.js

vs.

https://raw.githubusercontent.com/dotansimha/angularjs-dropdown-multiselect/master/src/angularjs-dropdown-multiselect.js

Upvotes: 1

MayK
MayK

Reputation: 1329

Include the module in angular (i.e. in app.js) - angularjs-dropdown-multiselect

Upvotes: 4

Related Questions