JSFiddle - React, Tailwind, and code Playground

by Jscaptcha

HTML

<h1>
  Angular Doc
</h1>
<div>
  
Declare modrule without variable .
Var myApp = angular.module('myApp',['ngRoute']')

angular.module('myApp',['ngRoute']').controller('HomeController',HomeController);
function HomeController(){}


angular.module('myApp',['ngRoute']').factory('services',appFactory);
appFactory.$inject=['$http'];
function appFacrory($http) {
       
}


IIFE.js  (Immediately invoke function expression) remove variable from global scope.

(function (){
'use strict';

myApp.factory('appFactory',appFacrory);
function appFacrory() {}

})();


controller as with vm
function HomeController (){
	this.pageName={};
}

function HomeController(){
	var vm = this;
	vm.pageName ={};
	vm.sendMessage = function(){};
}


Function inside controller aphabetized 

function Session()
{
     	var vm =this;
	vm.getData = getData;
   	vm.search = search;
	
	function getData(){
		
	}
}


Function Declaration to hide implementation and malke dependency hierarchical

var vm = this;
vm.activeItems = activeItems;
vm.getData = getData;
activate();
function activate(){ 
	return getActiveData().then(function(){
		$log.info('');
	})
}
function getActiveData() {
	return dataservice.getActiveItems().then(function(data){ 
           			vm.activeItems = data;
 			return vm.activeItems;
            })
}


Service Logic

Route Configuration

app.config(config);
function config($routeProvider){
	$routeProvider.when('/home' ,{
			templateUrl:'home.html',
			controller:'Averages',
			controllerAs:'vm'
	});
}


Service
Use factory instead for consistency

angular.module('app').service('logger',logger);
function logger(){
	this.logError = function(){}
}

.factory('logger',logger)
{
	rerurn {
			logError: function(){}
		}
}







Factories

function dataService(){
	
	var service = {
		save:save,
		someValue:someValue
	};
           return service;
       
           function save(){};
	function someValue() {}
}


$q service help you to run functions asyc and use there return value

var...