How to use the angular.isString function in angular

To help you get started, we’ve selected a few angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eight04 / angular-datetime / lib / directive.js View on Github external
ngModel.$parsers.unshift(function(viewValue){
			// You will get undefined when input is required and model get unset
			if (angular.isUndefined(viewValue)) {
				viewValue = parser.getText();
			}
			
			if (!angular.isString(viewValue)) {
				// let unknown value pass through
				return viewValue;
			}

			mask.digest(null, viewValue);

			if (!parser.isInit()) {
				return undefined;
			}

			var date = parser.getDate();

			if (ngModel.$validate || validMinMax(date)) {
				if (modelParser) {
					return modelParser.setDate(date).getText();
				} else {
github google / openhtf / openhtf / io / frontend / client / app / views / station / param-value-directive.js View on Github external
ParamValueController.prototype.getValue = function() {
  var p = this.$scope.parameter();
  if (angular.isNumber(p.numeric_value)) {
    // can't easily do units since our proto parser doesn't support it
    // we'd have to either parse them in python and serve them separately
    // or fix protobuf.js
    return p.numeric_value;
  } else if (angular.isString(p.text_value)) {
    return p.text_value;
  }
  return "";
};
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / feeds / edit-feed / FeedDetailsController.ts View on Github external
var errorFn = function(response:any) {
                // Update model state
                self.model.state = "DISABLED";

                // Display error message
                var msg = "<p>The feed cannot be deleted at this time.</p><p>";
                msg += angular.isString(response.data.message) ? _.escape(response.data.message) : "Please try again later.";
                msg += "</p>";

                $mdDialog.hide();
                $mdDialog.show(
                        $mdDialog.alert()
                                .ariaLabel("Error deleting feed")
                                .clickOutsideToClose(true)
                                .htmlContent(msg)
                                .ok("Got it!")
                                .parent(document.body)
                                .title("Error deleting feed")
                );
            };
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / services / AccessControlService.ts View on Github external
setAllowedActions= (module: any, users: any, groups: any, actions: any)=> {
                // Build the request body
                var safeModule: any = angular.isString(module) ? module : this.DEFAULT_MODULE;
                var data: any = {actionSet: {name: safeModule, actions: actions}, change: "REPLACE"};

                if (angular.isArray(users)) {
                    data.users = users;
                } else if (angular.isString(users)) {
                    data.users = [users];
                }

                if (angular.isArray(groups)) {
                    data.groups = groups;
                } else if (angular.isString(groups)) {
                    data.groups = [groups];
                }

                // Send the request
                return this.$http({
                    data: angular.toJson(data),
                    method: "POST",
                    url: this.CommonRestUrlService.SECURITY_BASE_URL + "/actions/" + encodeURIComponent(safeModule) + "/allowed"
                }).then((response: any)=>{
                    if (angular.isUndefined(response.data.actions)) {
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / feeds / edit-feed / lineage / feed-lineage.ts View on Github external
datasourceNodeLabel = function(ds:any){
                var label = "";
                if (angular.isString(ds.datasourceType)) {
                    label = this.Utils.endsWith(ds.datasourceType.toLowerCase(), "datasource") ? ds.datasourceType.substring(0, ds.datasourceType.toLowerCase().lastIndexOf("datasource")) : ds.datasourceType;
                    if(label && label.toLowerCase() == 'database'){
                        //attempt to find the name of the database in the properties
                        if(ds.properties && ds.properties['Database Connection']){
                            label = ds.properties['Database Connection'];
                        }
                    }
                } else if (angular.isString(ds.type)) {
                    label = ds.type;
                } else {
                    label = this.Utils.endsWith(ds["@type"].toLowerCase(), "datasource") ? ds["@type"].substring(0, ds["@type"].toLowerCase().lastIndexOf("datasource")) : ds["@type"];
                }
    
                label += "\n" + ds.name;
                return label;
            };
github benmarch / angular-ui-tour / app / tour-controller.js View on Github external
function getStep(stepOrStepIdOrIndex) {
        //index
        if (angular.isNumber(stepOrStepIdOrIndex)) {
            return stepList[stepOrStepIdOrIndex];
        }

        //ID string
        if (angular.isString(stepOrStepIdOrIndex)) {
            return stepList.filter(function (step) {
                return step.stepId === stepOrStepIdOrIndex;
            })[0];
        }

        //object
        if (angular.isObject(stepOrStepIdOrIndex)) {
            //step identity
            if (~stepList.indexOf(stepOrStepIdOrIndex)) {
                return stepOrStepIdOrIndex;
            }

            //step copy
            if (stepOrStepIdOrIndex.stepId) {
                return stepList.filter(function (step) {
                    return step.stepId === stepOrStepIdOrIndex.stepId;
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / services / DomainTypesService.ts View on Github external
function getRegExp(pattern: any, flags: any) {
            var safeFlags = angular.isString(flags) ? flags : "";
            return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFlags) : null;
        }
github google / openhtf / openhtf / io / frontend / client / app / components / filters / capitalize-filter.js View on Github external
function Capitalize(input) {
  if (!angular.isString(input) || !input.length) {
    return input;
  }
  return input[0].toUpperCase() + input.substr(1).toLowerCase();
}
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / services / DomainTypesService.ts View on Github external
function getRegExp(pattern: any, flags: any) {
            var safeFlags = angular.isString(flags) ? flags : "";
            return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFlags) : null;
        }
github cockpit-project / cockpit / pkg / kubernetes / scripts / kube-client.js View on Github external
function load(injector, name) {
                        if (angular.isString(name))
                            return injector.get(name, "KubeRequest");
                        else
                            return injector.invoke(name);
                    }