I had a problem getting partial data inside my index.html this is a view of my file tree:
tree structure
and my index page looks like this:
index.html
So, I'm not sure what else you need to see that I know that the routes work, because I checked with ARC (chrome application). So, if there is anything else you need to help you better, just let me know and I will be glady to get it for you. My question is, not how you (or can do) partial with angular
BeeperApp.js file
var app = angular.module('beeperApp', ['ngRoute']);
app.config(function($routeProvider){
$routeProvider
.when('/', {
templateUrl: 'main.html',
controller: 'mainController'
})
.when('/login', {
templateUrl: 'login.html',
controller: 'authController'
})
.when('/register', {
templateUrl: 'register.html',
controller: 'authController'
});
});
app.controller('mainController', function ($scope) {
$scope.posts = [];
$scope.newPost = {created_by: '', text: '', created_at: ''};
$scope.post = function () {
$scope.newPost.created_at = Date.now();
$scope.posts.push($scope.newPost);
$scope.newPost = {created_by: '', text: '', created_at: ''};
};
});
app.controller('authController', function ($scope) {
$scope.user = {username: '', email: '', password: ''};
$scope.error_message = '';
$scope.login = function () {
$scope.error_message = 'login request for ' + $scope.user.username;
};
$scope.register = function () {
$scope.error_message = 'register request for ' + $scope.user.username;
};
});
app.controller('loginController', function ($scope) {
$scope.user = {username: '', password: ''};
$scope.error_message = '';
$scope.login = function () {
$scope.error_message = 'login request for ' + $scope.user.username;
};
});
source
share