Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using angular js - ui.router concept for SinglePageApplication Development.
When i click Page 1 and Page 2 link, then its respective html page will be rendered into 'ui-view' div. I want to add 'data-ng-blur' attribute into respective html page(Sample.html, Sample2.html), input controls while click 'ui-sref' link. I have give Document ready events in
that both htmls, But that's not fired. So there is any option for add attributes for input elements in loading html before its respective Controller called by ui-router.

Code :

<div data-ng-app="ProjectApp">
<div class="menulist">
	<li><a ui-sref="pageone">Page 1</a></li>
	<li><a ui-sref="pagetwo">Page 2</a></li>	
</div>

<div class="ui-view"></div> 

<script>
 var loApp = angular.module("ProjectApp", ["ui.router"]);
loApp.config(function ($urlRouterProvider, $stateProvider, $urlMatcherFactoryProvider) {
    $urlMatcherFactoryProvider.caseInsenstiveMatch = true;
    
    $stateProvider
    .state('pageone', {
        url: '/Screen-one',
        templateUrl: 'Sample.html',
        controller: pageoneCtrler
    })
    .state('pagetwo', {
        url: '/Screen-two',
        templateUrl: 'Sample2.html',
        controller: pagetwoCtrler            
    });
});

loApp.controller("pageoneCtrler", function ($scope) {
	$scope.myfunction = function(){
  
	}
});

loApp.controller("pagetwoCtrler", function ($scope) {

});

</script>
</div>


What I have tried:

I tried to give document ready events in that htmls(Sample.html, Sample2.html), but its not fired when html loading in ui-view div.
Posted
Updated 4-Aug-17 5:03am
v2

1 solution

JQuery reference must be added before the angular js reference. If we add reference in this order, then document ready events fired of loaded htmls will be fired. Issue solved now.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900