我试图在我现有的AngularJS应用程序中使用
anuglar-slider.
我遵循作者的评论here
我从作者的github下载了下面的文件(头标记),并添加到我的index.html中
HTML代码:
<head> <link rel="stylesheet" href="css/angular-slider.css"> <script src="js/vendor/angular-slider.js"></script> </head> <body> <slider floor="10" ceiling="60" ng-model-low="lowValue" ng-model-high="highValue"></slider> </body>
App.js(角色代码).我根据作者的指示添加了第二行,我怀疑我在那里做错了
var app = angular.module('myApp',[])
angular.module('uiSlider',[]);
app.constant('Config',{
baseURL : "http://blah",httpTimeout : 36000
});
app.config(function($logProvider) {
$logProvider.debugEnabled(true);
});
//and some other app specific code follows
浏览器中没有任何滑块渲染.然而,应用程序中较早的角色特定功能仍然可行,浏览器控制台中没有错误.
如果您无法找到上述问题,请随时建议在AngularJS应用程序中实现范围滑块.
我对AngularJS很新
让我知道,如果你喜欢我在这里发布作者的图书馆文件的代码.
解决方法
好的,我在准备时发现了一些麻烦,但现在它正在运作:
造成麻烦:
>需要angularjs版本1.1.4或更高版本
>你需要slider-template.html文件
>和@Pascal一样说你需要包括uiSlider:
var app = angular.module('myApp',['uiSlider'])
>我为你准备了下面的工作演示.我希望它能帮助你
DEMO