Sometimes, we require to scroll on specific element or div on angularjs application like scroll for go on specific comment, scroll on specific table row it. However we can do it using anchorscroll in angularjs application.
anchorscroll() will help to scroll on specific "anchor" div id. anchorscroll() is provided by angularjs. We can use it simply. We don't require to write login on code jquery, because it is easy to do using anchorscroll(). $anchorScroll will use with $location variable hash.
I gave you full example of how to scroll on specific element on angularjs page, We can use simple as.....
When i was working on my Laravel angularjs application, i require to make array from comma separated string, I was not expert in angularjs so i was thingking how is it possible ?, But Finally i was found solution using custom angularjs Filter.
So, In this example, I will give you full example of how to convert comma separated string into array and how to print it. We will create array using split() of jquery. But if you know angularjs we can't do it anything directly from layout, So we should create our custom filter, as bellow you can see i created "customSplitString" filter.
Sometimes, We may require to make to show read more and read less functionality in our AngularJS application. We can make read more using AngularJS Directive.
So, In this example i going to give you full example of read more text example. I used "dd-text-collapse" Directive for after some text it will return "..." OR "(more)" etc that as you want. You can simply customize this Directive. You can also make toggle read more and read less using this Directive.
First, you can see bellow code of just Directive, i give you bellow code of Directive, you can use direct in your AngularJS application......
Sometimes we require to display message conversion in your angularJS App, But if you are using textarea for write comment or something then text display on same like without line break. But we can display text with likebreak using nl2br(). we can use directly in nl2br() if we work on PHP But if we work on angulaJS then we can't use it directly Because it is not pre-define function.
So, we require to make custom helper or something, So in this example i created custom angular filter for nl2br, that way we can use it globally in angularJS app. we will use nl2br filter add like as bellow :
We always require to check image is exists or not in given path, If not exists then we have to set default image. If we work on PHP or any framework then we check condition or something else for image exists of not to check But If you are working on AngularJS framework then we can do it using "directive".
AngularJS directive through we can simple check image is exists or not on the given url path. In this example i use ng-src and err-src attribute to manage image, directive will check ng-src url image is exists or not, if not then it will set err-src image as default.
So, I give you very bas.....
Sometimes, we require to set value of input box from js code, But if you bind with ng-model of angular then you can't set value directly with "val()" of jquery. As Bellow example:
But of you set this way then it will display in your text box layout, but you can't get from on submit function. So, you have to also trigger input that way AngularJS can get on controller method.
You can see bellow full example that way you can understand how to solve this issue:
<pre class="prettyprint lang-html">
Today, i am going to show you how to call angular function in your js file. Sometimes we need to call angular controller function in our jquery code because we can make single function in all project.
It is very simple post but it important because many times we require to call angularjs function from jquery.
So, i given bellow example will help you how to call angularjs function in jquery. It is from scratch that way you can simply understand.
In this example i created one function "$scope.makeAlert()" In my AngularJS controller. This function have one argument that way we can also pass a.....
If you work on AngularJS web application using angular route then you notice one thing. If you click on any hyper links it makes like as bellow:
I mean always "#" will be there, But when we live this web application then it should delete "#" from URL, because it makes issue when we share link on facebook or etc.
But should look likes:
But we can remove easily using "$locationProvider.html5Mode(true);". Yo.....
Sometimes, we require to make image uploading with preview selected image before upload using AngularJS. So, This post will help you how to image or file upload in AngularJS and PHP.
In this example i didn't user any plugin or directive for image upload. It is very simple so you can use very simple and anywhere. For front-end code write in AngularJS and back-end code write in PHP(for image upload code). It will also display preview of image before upload.
Example is working on bellow listed three things, you can see.
Sometimes we require to do like hide div or text or any tag after some time using AngularJS. In this example i am going to show you how to do it.
AngularJS have $timeout variable, $timeout variable through we can set specific time after hide. We can easily set time for hide or show. In this simple example you can see how it is works.
Bellow example you can see and run bellow file in your machine.
<pre class="prettyprint lang-html">
<title>Angularjs ng-hide div after few seconds</title>
<script src = ".....