I need to make a single page html app in angular js, that loads
page/template from dynamic php app. Below is what I have done
<script type="text/javascript">
var appModule = angular.module('appModule', ['ngRoute']);
appModule.config(['$routeProvider','$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider.
when('/', {templateUrl: '/index.php'}).
when('/music', {templateUrl: '/music'}).
when('/login/:name', {templateUrl: function ($args){return '/login/' +
$args.name;}}).
when('/music/:name', {templateUrl: function ($args){return '/music/' +
$args.name;}}).
when('/signup/:name', {templateUrl: function ($args){return '/signup/' +
$args.name;}}).
when('/event/:name', {templateUrl: function ($args){return '/event/' +
$args.name;}}).
when('/profile/:name', {templateUrl: function ($args){return '/profile/' +
$args.name;}}).
when('/*', { templateUrl: '/*' }).
otherwise({redirectTo: '/'});
// use the HTML5 History API
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
}]);
appModule.controller("MainController", ['$scope','$http','$rootScope',
function($scope,$http,$rootScope) {
console.log("This is reverbnation site.");
}]);
</script>
Above works fine except I need to define every URL in HTML, I don't think
that is possible. So I want it to be dynamic.
I want that links like this <a href="/music/1/play/true">play music</a> to
go template url '/music/1/play/true'.
so basically the request link should be = templateUrl
*WHY DO I NEED TO DO THIS?*
I have a music player on the page, I want it to play while user is browsing
the website. I have website ready and music player is ready in HTML, i
just need to make them both work together, just like www.reverbnation.com
Any clues?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.