Basic AngularJS template for Aspx

I have not made the big jump to Angular 8 so I am still using AngularJS.  Here is my basic template to get started with a simple .net aspx page.

Here is my HTML:

    <div ng-app="app" ng-controller="BasicTemplateController" class="container-fluid">
        <div class="panel panel-default">
            <div class="panel-heading">Basic Template</div>
            <div class="panel-body">




Here is my JS:

    <script type="text/javascript">

        (function () {
            'use strict';

                .module('app', [])
                .factory('basicTemplateDataService', ['$http', basicTemplateDataService])
                .controller('BasicTemplateController', ['$scope', 'basicTemplateDataService', basicTemplateController]);

            function BasicTemplateController($scope, basicTemplateDataService, $routeParams) {
                $scope.LoadingData = false; 
				$scope.myData = [];

                $scope.DoSomething = doSomething;
                function doSomething() {
                        .then(function (response) {
                            $scope.myData =;

                function init() {

            function basicTemplateDataService($http) {
                var fac = {};                               //using factory method i am configuring service.
                var svcUrl = '<%= Page.ResolveUrl("~/basicTemplates.aspx")%>';
                fac.getSomething = function () {
                    return $ + '/getSomething', {});
                return fac;


The data service factory can point to any endpoint.  I tend to create pageMethods in the code behind of the aspx page as such:

    Public Shared Function getSomething(id As Integer, currentUserID As Integer) As String
        Dim res As String
		res = "Yes Sirrrr"

        Return res
    End Function


Add comment