Commit d256c197 authored by Randall Leeds's avatar Randall Leeds

Fix authentication directive for angular upgrade

The isolation scopes are truly isolated better, or evaluation
of the submit handler is happening from the descendent cousin
scopes of the isolated directive. I could probably have moved
the ng-submit handler below the authentication directive, but
I didn't see a compelling reason for the directive to stay in
an isolated scope.
parent b171c1bc
authentication = -> authentication = ->
base =
username: null
email: null
password: null
code: null
link: (scope, elem, attr, ctrl) ->
angular.extend scope, base
controller: [ controller: [
'$scope', 'authentication', '$scope', 'authentication',
($scope, authentication) -> ($scope, authentication) ->
$scope.$on '$reset', => angular.extend $scope.model, base $scope.$on '$reset', => angular.extend $scope.model, base
$scope.model = authentication
$scope.submit = (form) -> $scope.submit = (form) ->
return unless form.$valid return unless form.$valid
authentication["$#{form.$name}"] -> authentication["$#{form.$name}"] ->
$scope.$emit 'success', form.$name $scope.$emit 'success', form.$name
] ]
scope: restrict: 'ACE'
model: '=authentication'
markdown = ['$filter', '$timeout', ($filter, $timeout) -> markdown = ['$filter', '$timeout', ($filter, $timeout) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment