Angular with express ejs

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
    //the timeline display
        .when('/', {
            templateUrl: 'main.html',
            controller: 'mainController'
        })
        //the login display
        .when('/login', {
            templateUrl: 'login.html',
            controller: 'authController'
        })
        //the signup display
        .when('/register', {
            templateUrl: 'register.html',
            controller: 'authController'
        });
});

app.controller('mainController', function ($scope) {
    $scope.posts = [];
    $scope.newPost = {created_by: '', text: '', created_at: ''};

    $scope.post = function () {
        //Add a created at (time and date) for a new post
        $scope.newPost.created_at = Date.now();

        //Take whatever was created in new post and add that to the post message
        $scope.posts.push($scope.newPost);

        //Reset the new post to empty
        $scope.newPost = {created_by: '', text: '', created_at: ''};
    };
});

app.controller('authController', function ($scope) {
    $scope.user = {username: '', email: '', password: ''};
    $scope.error_message = '';

    $scope.login = function () {
        //authentication
        $scope.error_message = 'login request for ' + $scope.user.username;
    };

    $scope.register = function () {
        //authentication
        $scope.error_message = 'register request for ' + $scope.user.username;
    };
});

app.controller('loginController', function ($scope) {
    $scope.user = {username: '', password: ''};
    $scope.error_message = '';

    $scope.login = function () {
        //authentication
        $scope.error_message = 'login request for ' + $scope.user.username;
    };
});
+4
source share

Source: https://habr.com/ru/post/1664077/


All Articles