javascript AngularJS + jQuery 移动版
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20239560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AngularJS + jQuery Mobile
提问by sgalenski
Are there other possibilities to style an AngularJS
application in a mobile friendly way than CSS
?
是否有其他可能性以AngularJS
移动友好的方式设计应用程序CSS
?
I am planning a mobile app and want to use AngularJS for the logic and data binding but I don't want to style everything on my own with CSS
.
我正在计划一个移动应用程序,并希望使用 AngularJS 进行逻辑和数据绑定,但我不想使用CSS
.
The AngularJS
FAQ says that it uses jQuery
:
该AngularJS
FAQ说,它使用jQuery
:
Does Angular use the jQuery library? Yes, Angular can use jQuery if it's present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.
Due to a change to use on()/off() rather than bind()/unbind(), Angular 1.2 only operates with jQuery 1.7.1 or above.
Angular 是否使用 jQuery 库?是的,如果在应用程序启动时 jQuery 存在于您的应用程序中,Angular 可以使用它。如果 jQuery 不存在于您的脚本路径中,Angular 将回退到我们称为 jQLite 的 jQuery 子集的它自己的实现。
由于使用 on()/off() 而不是 bind()/unbind() 的更改,Angular 1.2 仅适用于 jQuery 1.7.1 或更高版本。
but there is no information I have found in the FAQ on which way AngularJS + jQuery
can be used.
但是我在常见问题解答中没有找到关于AngularJS + jQuery
可以使用哪种方式的信息。
As you can see I have tried to get the information using AngularsJS FAQ, but could not found it.
如您所见,我尝试使用 AngularsJS 常见问题解答获取信息,但找不到。
Have you found some example(s) of AngularJS
with jQuery Mobile
for styling?
你有没有找到一些AngularJS
withjQuery Mobile
样式的例子?
回答by MikroDel
There was already the question on SOto compare AngularJS
and jQuery Mobile
.
已经有关于SO的问题要比较AngularJS
和jQuery Mobile
。
And in the answeryou can find some information - it is kind of further reading for you.
在答案中,您可以找到一些信息——这是对您的进一步阅读。
And the arcticle jQuery Mobile and AngularJS Working Togethershould give you answe to your question. It has some advices, for example:
而文章jQuery Mobile 和 AngularJS Working Together应该可以回答你的问题。它有一些建议,例如:
Load jQM libs before AngularJS
在 AngularJS 之前加载 jQM 库
or
或者
Let jQM handle the URL routing
让 jQM 处理 URL 路由
etc.
等等。
回答by Mark Ni
A very basic example:
一个非常基本的例子:
html:
html:
<body ng-app='myApp'>
<div data-role="page" ng-controller='myCtrl'>
<ul data-role="listview">
<li ng-repeat='car in cars'><a href="{{car}}.html">{{car}}</a>
</li>
</ul>
</div>
</body>
js:
js:
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.cars = [
'acura', 'audi', 'BMW'
];
});
working demo: http://jsfiddle.net/eZdNm/
工作演示:http: //jsfiddle.net/eZdNm/
The main problem with jQuery mobile and AngularJS is they both want to control page routing. You can find out more by searchng jQuery mobile and Angular in google.
jQuery mobile 和 AngularJS 的主要问题是它们都想控制页面路由。您可以通过在 google 中搜索 jQuery mobile 和 Angular 来了解更多信息。
Yes, if you only want a ready to go / mobile friendly UI. I would suggest other more CSS based frameworks such as bootstrap.
是的,如果您只想要一个随时可用的/移动友好的用户界面。我会建议其他更多基于 CSS 的框架,例如 bootstrap。