Created
May 6, 2014 21:44
-
-
Save terrancebryant/19ef51e2ca7f04e17d29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="description" content="Controller" /> | |
| <script src="http://code.jquery.com/jquery.min.js"></script> | |
| <link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
| <script src="http://getbootstrap.com/dist/js/bootstrap.js"></script> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <div ng-app="myApp"> | |
| <div ng-controller="FirstCtrl"> | |
| <input type="text" class="form-control" ng-model="data.message"> | |
| <h3>{{data.message}}</h3> | |
| </div> | |
| <div ng-controller="SecondCtrl"> | |
| <input type="text" class="form-control" ng-model="data.message"> | |
| <h3>{{ reversedMessage(data.message) }}</h3> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myApp = angular.module('myApp', []); | |
| myApp.factory('Data', function () { | |
| return { message: "I'm data from a service" }; | |
| }); | |
| function FirstCtrl($scope, Data) { | |
| $scope.data = Data; | |
| } | |
| function SecondCtrl($scope, Data) { | |
| $scope.data = Data; | |
| $scope.reversedMessage = function(message) { | |
| return message.split("").reverse().join("").toUpperCase(); | |
| }; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment