• About Morris Development
  • A Focus for Cloud Efficiency
    • Microsoft Azure
    • Amazon Web Services
  • What our Clients Say
  • Our Products
    • PreschoolDB
    • WebinarDB
  • Contact Us

Morris Development

Custom System Development and Integration

April 4, 2016

Basic Template for a TypeScript controller

After making almost 100 controllers for one system, we’ve established a standardized method for controllers.

First: we no longer do any Javascript directly. Typescript is completely taken over. Our development speed has increased substantially. It took a while, but now none of us would go back.

We’ve organized our structure into modules:

Application.Domain.[whatever common modules we will use across all controllers]
Application.Controllers.[whatever controller or set of controllers we will be loading]
Application.Types.[All standardized interfaces we’ve made ourselves]


/// 

module Application.Controllers.StandardizedNotes {
    class notes {

        static $inject =
        [
            '$scope', '$http', '$location', '$window', '$filter', '$log', '$cookies', '$routeParams'  // standard angular modules
            , 'jobFact'  // custom modules and factories
        ];

        public Offices: any;
        public office_id: number;
        constructor(
            private $scope: ng.IScope,
            private $http: ng.IHttpService,
            private $location: ng.ILocationService,
            private $window: ng.IWindowService,
            private $filter: ng.IFilterService,
            private $log: ng.ILogService,
            private $cookies: Types.ICookiesService,
            private $routeParams: ng.RouteDefinition,
            private jobFact: any                    

        ) {
            var self = this;
            self.$window.document.title = "Standardized Notes";
             
        }

     }

    app.controller("notes", notes);
}

While this isn’t super exciting, we can cut and past this clip into any new controller we want to make, remove any libraries we don’t need, add any custom modules we will need, and just move on.

The “ref” link at the top is to an application file. THAT file then contains references to all of our typing and other needs for Intelliesense.

There are a LOT of ways to do this, but we’ve honestly not found a faster and safer way of getting an angular controller up and running.

Article by MacGyver / AngularJS, TypeScript

About MacGyver

I've worked with database systems for over 20 years, and started my own company in 2000. Almost all my business consists of internal database systems, either ERP or CRM. My programming is primarily in Angular / Microsoft C# and MS SQL.

About This Site

Morris Development has been specializing in internal database system design and integration since 1999. We provide long-term management and support of secure data systems for many businesses as well as developing the more complex code structures for ERP systems like Intellievent, Apidas, and AVMS.

This site is primarily for our developers to keep track up various technologies and updates that are used by Morris Development.

Training

Integrating Angular Microsite with .Net

Private Data Caching with Google Storage

Continuous Deployment for Production Releases?

Azure Websites – the perfect Angular host

Angular 2

  • Angular 2 Authentication
  • Angular Command Line Interface
  • Material Design for Angular
  • Using Observables in Angular 2

Mentors

  • Ben Nadel
  • Dan Wahlin
  • Deborah Kurata
  • John Papa

Staff

  • Dan Morris

Training

  • Google Development Courses
  • Microsoft Virtual Academy
  • PluralSight
  • Test Deep Links

© 2025 · Morris Development