Skip to content

Instantly share code, notes, and snippets.

@metasansana
Last active August 29, 2015 14:14
Show Gist options
  • Save metasansana/c2e242ff3b4d298a3a45 to your computer and use it in GitHub Desktop.
Save metasansana/c2e242ff3b4d298a3a45 to your computer and use it in GitHub Desktop.
Generic Form as directive with controller
var app = angular.module('myApp', []);
app.directive('contactGeneric', function () {
return {
restrict: 'E',
templateUrl: 'contactGeneric.html',
bindToController: true,
controllerAs: 'contactGeneric',
controller: ['$http', function ($http) {
$http.get('/data').then(function (res) {
this.data = res.data;
}.bind(this));
}]
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment