integrate jquery plugin in angularjs -
i new angular ,i bit confused how use jquery pluging angular.
i want use subway map pluging in angular app
i create new directive subway map :
angular.module('myapp.directives', []). directive('subwaymap', function() { return { // restrict attribute in case restrict: 'a', // responsible registering dom listeners updating dom link: function(scope, element, attrs) { angular.element(element).subwaymap({ debug: true }); } };
});
and use in html page : `
<div subway-map> <ul data-color="#ef0010" data-label="jquery interactions" data-shiftcoords="0,-1"> <li data-coords="20,14">o</li> <li data-coords="21,14">p</li> <li data-coords="22,14">q</li> <li data-coords="23,14">r</li> <li data-coords="24,14">s</li> </ul> </div>
but have error in subwaymap js :
referenceerror: jquery not defined
})(jquery);
how solve error ?
thank help
edit :
the problem in directive file, here directive file, appversion directive works when remove subwaymap
thanks /*global define / 'use strict'; define(['angular'], function(angular) { / directives */ angular.module('myapp.directives', []). directive('appversion', ['version', function(version) { return function(scope, elm, attrs) { elm.text(version); }; }]); angular.module('myapp.directives', []). directive('subwaymap', function() { return { // restrict attribute in case restrict: 'a', // responsible registering dom listeners updating dom link: function(scope, element, attrs) { angular.element(element).subwaymap({ debug: true }); } }; }); });
thnks
Comments
Post a Comment