Am learning ionic and I want to use this directive international-phone-number direcrive. I have linked the file on my index.html page
<script src="lib/international-phone-number/releases/international-phone-number.js"></script>
and in my view used one of the default examples from the link <input type="text" international-phone-number only-countries="pl, de, en, es" default-country="pl" preferred-countries="pl, de" ng-model="phone">
the directive is not working for me , what could I be doing wrong?
Related
I'm trying to implement an Angular UI Bootstrap Carousel and have HTML in the texts. Thought I could use something like
text: $sce.trustAsHtml('Nice image <br />test')
but apparently that doesn't work and I've no clue why.
Plunkr: https://plnkr.co/edit/9PvaS8SoRmN1o52wiAf8?p=preview (fork of the offical example from the docs).
Use ng-bind-html directive to display html content on view
<p ng-bind-html="slide.text"></p>
Demo Plunkr
I have HTML file that is loaded by Angular JS in ng-view. This file contens code:
<script type="text/ng-template" id="searchbox.tpl.html">
<input type="text" placeholder="Search Box">
</script>
Why input fiels is not displayed in template? I see blank page.
This is Angular JS code:
$scope.searchbox = { template: 'searchbox.tpl.html', events: events };
Updated:
HTML file with include:
<div class="input-wrap">
<div ng-include="searchbox.template"></div>
</div>
HTML file searchbox.template:
<input type="text" ng-model="formData.address" ng-trim="true" ng-minlength="3" required>
You have added script that doesn't mean that it will render inner html on the page. After reading that script from Html, Since the type of script is type="text/ng-template" so angular internally put that script content inside a $templateCache service, And you can access that as template by using its id value as url in anywhere.
For getting shown it on the page you should use ng-include that will have src with searchbox.tpl.html
Markup
<div ng-include="searchbox.template"></div>
Working Plunkr
I'm getting neither a value emitted by the template fragment nor functioning validation. My Jade template:
doctype html
html(lang='en', ng-app="Validate")
head
script(src='#{cdn_path}/angular.js/1.3.11/angular.js')
script(src='#{cdn_path}/angular.js/1.3.11/angular-messages.js')
script.
angular.module('Validate', ['ngMessages']);
body
.container
form(method="POST", action="/apply", name="myform", novalidate="")
pre myform.name.$error = {{ myform.name.$error }}
input.form-control(name="name", required="", pattern=".*[a-zA-Z].*", minlength=5)
ng-messages(for="myform.name.$error")
ng-message(when="required") Required!
ng-message(when="min") Too small!
input.btn(type='submit')
The resulting HTML: http://plnkr.co/edit/McyMXwW1b2Ae7kkwQ1sP
I'd like to avoid custom directives or much in the way of additional Javascript. What am I doing wrong?
This is happening because you didn't bind ng-model with the input :-)
<input name="name" ng-model="name" required="" pattern=".*[a-zA-Z].*" minlength="5" class="form-control">
<ng-messages for="myform.name.$error">
<ng-message when="minlength">Too small!</ng-message>
<ng-message when="required">Required!</ng-message>
Plunker:- http://plnkr.co/edit/kmNkfhdVOHQsstj6dpPT?p=preview
I just have the same issue and solved it. I want to share it so no one will waste an hour like me.
Please ensure the following:
1. Load the ngMessages module
<!-- Load Angular -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular.min.js"></script>
<!-- Load ngMessages -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular-messages.min.js"></script>
2. Inject ngMessages into our application module
angular.module( "app", [ "ngMessages" ] );
3. Try newer versions
For some reason, Doug Luce's code gets working just by changing versions to e.g., 4.11!
I have the jquery dialog with input ng-model
<input type="text" ng-model="testing">
{{testing}} // This works
But if I declare {{testing}} outside of jquery dialog angular is not binding the data. Why this is happening. How to fix this.
Here is the fiddle currently working
Try to put all of your elements inside a controller.
<div ng-app>
<div ng-controller="Ctrl">
see
example
I have 3 questions
can i use angular js with kendoUi wrappers? if yes how?
if i am using angular js and kendo-all.min.js on the same html tag let say that we are converting an input tag to auto-complete and at the same time we are binding it with ng-model then what possible affect they can produce in each other?
what actually angular-kendo is?
code for Point No-2
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/Kendo/kendo.all.min.js"></script>
<script src="~/Scripts/angular/angular.js"></script>
<script src="~/Scripts/angular/app.js"></script>*#
<script type="text/javascript">
$(document).ready(function () {
var data = ["akshay", "tiwari", "ranjit", "swain"];
$("#name").kendoAutoComplete({ dataSource: data });
})
</script>
<h2>KendoAngular</h2>
<div ng-app>
<input id="name" type ="text" ng-model="yourName"/>
<h2>{{yourName}}</h2>
</div>
There is a kendo project that you'll need to include: https://github.com/kendo-labs/angular-kendo
What will happen is that as the user types in say an autocomplete, the selection will be bound to an angular scope item. The "wrapper" is what makes all the bindings and allow angular to be updated.
From the github: angular-kendo is a directive for AngularJS that runs an element through Kendo UI declarative initialization, allowing you to take full advantage of Kendo UI within the context of an AngularJS Application.
You plunker is not including the angular adapter located at the link above.
Here are the instructions for its use: http://kendo-labs.github.io/angular-kendo/#/simple
var app = angular.module('your-angular-app', ["kendo.directives"]); // include directives
Add data-kendo and appropriate data- attributes.