Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Allow interpolation inside ng-message (fix for #11616) #12001

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ngMessages/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,13 @@ angular.module('ngMessages', [])
var INACTIVE_CLASS = 'ng-inactive';

return {
require: 'ngMessages',
restrict: 'AE',
bindToController: {
ngMessages: '@',
forAttr: '@for'
},
scope: true,
controllerAs: 'ngMessagesController',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and scope: true are changing the semantics of the directive. Not sure if we want this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @Narretz we do not want to add this new scope

controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
var ctrl = this;
var latestKey = 0;
Expand Down Expand Up @@ -384,7 +389,7 @@ angular.module('ngMessages', [])
: $animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS);
};

$scope.$watchCollection($attrs.ngMessages || $attrs['for'], ctrl.render);
$scope.$watchCollection(ctrl.ngMessages || ctrl.forAttr, ctrl.render);

this.reRender = function() {
if (!renderLater) {
Expand Down