AngularJS Directive Example

In this example below you will see how to do a AngularJS Directive Example with some HTML / CSS and Javascript

Example code used in my video tutorial "AngularJS: The Pros, MV* Terminology, and Example Code" (Link:

This awesome code was written by 13thDayCoder, you can see more from this user in the personal repository.
You can find the original code on
Copyright 13thDayCoder ©


  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>AngularJS Directive Example</title>
      <link rel="stylesheet" href="css/style.css">



  <body ng-app="myApp">
    <div ng-controller ="mainController as mainCtr">
            <label for="song-name">What is your favorite song? </label>
            <input ng-model="" type="text" name="song-name">

        <p>Your favorite song is "{{}}"</p>
  <script src=''></script>


    <script  src="js/index.js"></script>



/*Downloaded from */
html, body, label, input {
  font-size: 1.2em;

/*Downloaded from */
var app = angular.module('myApp', []);

app.controller('mainController', function () {
    var mv = this; = "All About That Bass";