FAQ Database Discussion Community

AngularJS directive: scope with named controller

I have the example below. HTML: <body ng-controller="MainCtrl as MgtCtrl"> <p>Hello {{MgtCtrl.name}}!</p> <p>Result is {{MgtCtrl.result}}!</p> <output-content data="MgtCtrl.name" result="MgtCtrl.result"></output-content> </body> JavaScript: var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope) { var MgtCtrl = this; MgtCtrl.name = 'World'; MgtCtrl.result = "no"; MgtCtrl.changeLabel = function() { alert('changeLabel'); MgtCtrl.result = 'yes'; } });...

Angular directive not watching

I'm using a directive in AngularJS, and I'm trying to check if my field is $dirty, if that's true i want to log a message and when it changes i want to show another message (That sentence will be replaced later for something more complex). I want to reuse in...

angular directive to make input respond on enter

i apologize if the question is vague, i'm not quite sure how else to explain what i need. There are some dirty options which come to mind, but i'm a novice angular coder and i feel there is a clean simple method to implement this with directives maybe? what i...

how to simplify the