| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This project has not been released yet. It is still in alpha stage, but it is usable in an app if you are willing to face a few API changes here and there.
##Description Native AngularJS directives for jQuery Mobile. Small footprint, no 3rd party JS dependencies (jQuery, jQuery Mobile JS) required!
##Why
This is very similar to the angular bootstrap integration: There is an adapter that uses the JavaScript part of bootstrap, angular-strap (http://mgcrea.github.io/angular-strap/), and another version that uses the boostrap css only from the angular-ui team (http://angular-ui.github.io/bootstrap/).
To ensure that our directives work correctly we create special tests that compare the generated markup of our directives with the markup generated by plain jquery mobile. By this it should also be easy to keep track of changes in jquery mobile when they release newer versions.
Dependencies
Directory structure
Commits:
Commands:
(this needs grunt-cli installed globally: npm install grunt-cli -g)
Tests:
for all source files we have unit tests
for all directives, we additionally have tests that compare the markup with the real jqm widgets (see testutils.js#compareElementRecursive).
unit tests may access every private function in jqm-angular:
For the whole build, we are using an immediately executing function expression to ensure that no variable leaks into the global scope. However, when running the unit tests we include the source files without that protection. Note: The same principle is used by angular for it's sources and unit tests.
Your main html file should look like this:
<!DOCTYPE html>
<html ng-app="app">
<head>
<link type="text/css" rel="stylesheet" href="jquery.mobile-1.3.1.css">
<script src="angular.js"></script>
<script src="angular-mobile.js"></script>
<script src="angular-jqm.js"></script>
<!-- include your application script files here -->
<script src="app.js"></script>
</head>
<body jqm-caching-view>
</body>
</html>
Inside your application scripts, define a new module that depends on the module jqm and setup routes for all pages that you want to display. E.g.:
var mod = angular.module('app', ['jqm']);
mod.config(function($routeProvider) {
// A route for a single page
$routeProvider.when("/", {
redirectTo: "main.html"
});
// A route for all pages in one folder
$routeProvider.when("/:page", {
animation: 'page-slide',
templateUrl: function(params) {
return params.page;
}
});
});
We already set up pages to play with during development and compare your directive with jquery mobile. For this, first do a grunt dev. Then visit one of the following pages:
| Back | FazBrowse Home | New Git URL |