Get an item using agularjs

2

Good friends. I'm using angle 1.6 and I've integrated ui-route for views, this is my code in index.html

<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" >
    <link href="https://fonts.googleapis.com/css?family=Nunito|PT+Sans|Slabo+27px" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/css/style.css">
    <script src="assets/js/angular.min.js"></script>
    <script src="assets/js/angular-ui-route.min.js"></script>
    <script src="assets/js/jquery.min.js"></script>
</head>
<body>
    <nav id="navbar" class="navbar fixed-top navbar-toggleable-md navbar-light bg-faded" ui-view="nav"></nav>
    <header id="header" class="area" ui-view="header"></header>
    <section id="page" class="area" ui-view="page"></section>
    <footer id="footer-main" ui-view="footer"></footer>
    <script src="assets/js/tether.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/scripts.js"></script>
</body>
</html>

Then, with ui-route I load the views, when I want to capture an element that is inside those views, it does not return it to me, the only ones that it returns are those that are in index.html

    
asked by Franklin'j Gil'z 25.02.2017 в 00:14
source

1 answer

1

I solved my problem, before I used

angular.element(document).find('.selector') // ejemplo

The problem is that the selector should be a label, as it is div , section , among others, and I needed to obtain them by id or by some value of an attribute. As use jquery I used $('.selector') directly, but as the document was not fully loaded it did not work ... so this code was still working for me

angular.element(document).ready(function(){
    $('.selector')
})
    
answered by 27.02.2017 / 18:23
source