Skip to content

Conversation

@codewiseio
Copy link
Contributor

Added package.json to allow for installation via npm.
Updated readme:

  • document intallation via npm
  • document must include compareField in angular app dependencies
  • cleaned up example to remove superfluous code which distracted from module usage example

Thank you for providing this module, it would be great if it was available to node users via npm. I have made the necessary changes to the package to include it in the node repository. After merging the pull request please add the library to npm or grant me permission to do so myself.

Signed-off-by: Codewise codewiseio@gmail.com

update to readme Signed-off-by: Codewise <codewiseio@gmail.com>
@Rafaliya-Haresh
Copy link

  1. create new file registration.directive.js

export default class RegistrationDirective {

constructor() { this.require = 'ngModel' this.scope = { targetModel: '=compareTo' } this.controller = RegistrationController; this.controllerAs = 'ctrl'; this.bindToController = true; } link(scope, element, attrs, ctrl) { var compare = function() { var e1 = element.val(); var e2 = scope.targetModel; if (e2 !== null) { return e1 === e2; } return false; }; scope.$watch(compare, function(newValue) { ctrl.$setValidity('errorCompareTo', newValue); }); } 

}

import angular from 'angular';

import RegistrationConfig from './registration.config';
import RegistrationController from './registration.controller';
import RegistrationService from './registration.service';
import RegistrationDirective from './registration.directive';

// Attach UI-Router states
let registrationModule = angular.module('doxa.registration', [])
.config(RegistrationConfig)
.controller('RegistrationController', RegistrationController)
.service('RegistrationService', RegistrationService )
.directive('compareTo', () => new RegistrationDirective);

export default registrationModule;

@ffariasdev ffariasdev merged commit 351de43 into lunardidev:master Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants