如何使用AngularJS创建工具提示?

时间:2015-05-18 15:40:46

标签: angularjs kendo-ui kendo-treeview

一旦用户从树下拉列表中选择值,我想调用与label相关联的工具提示的服务,以在输入字段中显示所选文本的描述。如何使用AngularJS工具提示功能完成任务并获取说明。我是AngularJS的新手任何细节帮助将不胜感激。

到目前为止尝试过Code ..

Ctrl.js

<!DOCTYPE html>
<html>
<head>
<script>

function validateForm() {
    var x = document.forms["myForm"]["token","id","percentage","duration"].value;
    if (x == "") {
        alert("There are empty fields");
        return false;
    }
    var y =document.forms.myForm.percentage.value;
    if(y>=0 && y<=100)
    {
    return true;
    }
    else
    {
    alert("Percentage output must be between 0 and 100");
    return false;
    }

    var k =document.forms.myForm.duration.value;
    if(k>=0 && k<=30000)
    {
    return true;
   }
   else{
   alert("Error");
   return false;
   }
}
</script>
</head>
<body>

<form name="myForm" onSubmit="return validateForm();">
Enter access token: <input type="text" name="token">
Enter device id: <input type="text" name="id">
Enter output percentage: <input type="text" name="percentage">
Enter duration(in milliseconds) of output: <input type="text" name="duration">
<input type="submit" value="Submit">
</form>

</body>
</html>

service.js

<div class="form-group col-md-6 fieldHeight">
    <label for="erh" class="col-md-5 required">Enterprise Reporting Hierarchy:
        <span ng-mouseover="tooltip={{erhHirachyInfo.erhToolTip}}" 
        class="glyphicon glyphicon-info-sign pull-right"></span>
    </label>
<div class="col-md-7">
    <div multiselect-dropdown-tree ng-model="nonPersistentProcess.erhKey"      
    options="erhTreeviewOptions">
    </div>
</div>

1 个答案:

答案 0 :(得分:1)