Skip to content

Instantly share code, notes, and snippets.

@Seich
Last active December 21, 2016 16:40
Show Gist options
  • Save Seich/076b146293023ad35d39649f8fa53a86 to your computer and use it in GitHub Desktop.
Save Seich/076b146293023ad35d39649f8fa53a86 to your computer and use it in GitHub Desktop.
Angular Cheatsheet
// https://docs.angularjs.org/api/ng/function/angular.module
var app = angular.module('name', []);
// https://docs.angularjs.org/guide/component
// https://toddmotto.com/exploring-the-angular-1-5-component-method/
app.component('name', {
templateUrl: '/name.html',
bindings: {
a: '<',
b: '@'
},
controller: function() {
}
});
app.config(function($urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
});
// https://docs.angularjs.org/guide/providers
app.service('name', function($http) {
this.method = function() {
return $http.get('/endpoint.json');
};
});
// https://ui-router.github.io/guide/ng1/route-to-component
app.config(($stateProvider) => {
$stateProvider.state('name', {
url: '/path',
component: 'name'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment