Use angular expression within the same object with ngrepeat - angularjs-ng-repeat

just wondering if anyone knows how i can get an angular expression from within the ng-repeat, in the same object. eg
<!..This is the abgpankit..>
<div ng-repeat="equip in portal[0].equipment[0].sub" id="{{equip.id}}" class="displaydiv">
<div class="contentimg">
<h3>{{equip.item}}</h3>
</div>
<a ng-repeat="x in equip.links" href="#pdfdiv" onclick ="return iframeSrc("{{x.links}}");">
<li>{{x.desc}}</li></a>
<div class="information">
<p>{{equip.info}}</p>
</div>
<div class="items">
<table>
<tr>
<th>Items in Kit</th>
</tr>
<tr>
<td class="icons">
<a href="#panharness" class="panharnessicon">
<div class="iconimg">
<h2>Pan Harness</h2></div></a>
</td>
<td class="icons">
<a href="#displaymodule" class="displaymodicon">
<div class="iconimg">
<h2>Display Module</h2></div></a>
</td>
<td class="icons">
<a href="#halo" class="haloicon">
<div class="iconimg">
<h2>Halo</h2></div></a>
</td>
<td class="icons">
<a href="#edm" class="edmicon">
<div class="iconimg">
<h2>EDM</h2></div></a>
</td>
<td class="icons">
<a href="#dm" class="dmicon">
<div class="iconimg">
<h2>DM</h2></div></a>
</td>
<td class="icons">
<a href="#sft" class="sfticon">
<div class="iconimg">
<h2>SFT</h2></div></a>
</td>
</tr>
</table>
</div>
</div>
Sorry just changed it to the actually code from the site. I believe i have the syntax right, i just though there might be some limitation using an expression in the same object the ng-repeat is defined in.
Once i sort this out i can move further down and fix things up.
Cheers,
Mitchell

Related

datatable shows blank spaces below the paginator links

I'm using larashop admin panel.The datatable shows blank spaces below the datatable..The height blank spaces increases with increase in datatable entries.I don't know what to do..
I tried some css.but none of them helped me.
#extends('templates.admin.layout')
#section('title', 'All Courses')
#section('content')
<div class="">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Courses <i class="fa fa-plus"></i> Create New </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<table id="datatable-buttons" class="table table-responsive">
<thead>
<tr>
<th>Course Name</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Course Name</th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
#if(count($courses))
#foreach ($courses as $row)
<tr>
<td>{{$row->name}}</td>
<td>
<i class="fa fa-pencil" title="Edit"></i>
<i class="fa fa-trash-o" title="Delete"></i>
</td>
</tr>
#endforeach
#endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
#stop
The screenshot of the issue is provided..please check...
https://i.stack.imgur.com/avqf5.png

Bootstrap Striped-table not working with Vuejs

I am creating a friends component that lists users friends based on a response from an endpoint.
I want to render the responses into rows of a table as part of this I would like to use the bootstrap striped-table class
https://getbootstrap.com/docs/4.0/content/tables/#striped-rows
when I do a v-for the table renders correctly but the rows are only showing one background color
This is my template code
<template>
<div>
<h5 class="mb-4">Friends</h5>
<table class="table table-borderless table-striped ">
<tbody>
<div v-for="(friend, index) in UserStore.friends">
<tr>
<td class="text-center" style="width: 100px;">
<img style="width: 100px;" :src="friend.avatar" alt="User Image" class="rounded-circle">
</td>
<td>
{{friend.name}}<br>
<small>29 years old on Friday</small>
</td>
<td class="text-center" style="width: 80px;">
<i class="fa fa-gift"></i>
</td>
</tr>
</div>
</tbody>
</table>
<div v-if="!UserStore.friends">
<h6>You don't have any friends :(</h6>
Lets solve that Right now!
</div>
</div>
</template>
You should use a template element to render these rows. .table-striped works with sibling rows and in your code the rows are not siblings because they each have a div parent, so each row is seen as the first row.
<tbody>
<template v-for="(friend, index) in UserStore.friends">
<tr>
<td class="text-center" style="width: 100px;">
<img style="width: 100px;" :src="friend.avatar" alt="User Image" class="rounded-circle">
</td>
<td>
{{friend.name}}<br>
<small>29 years old on Friday</small>
</td>
<td class="text-center" style="width: 80px;">
<i class="fa fa-gift"></i>
</td>
</tr>
</template>
</tbody>

How to highlight current active menu in Laravel 5.6 app?

I am using following bootstrap menu items with My laravel application,
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-sm-3 col-md-3">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><span class="glyphicon glyphicon-folder-close">
</span> Content Management</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Category
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Brand
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Model
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-flash text-success"></span>Province
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
and using this menu bar with #include('menubar) with other blade files. now I need highlight current menu item when I visit each pages. how can I do this?
use
{{ request()->route()->getName() }}
or
{{ route()->currentRouteName() }}
then you can do something like
<a class="{{ request()->route()->getName() === "brands.index" ? "active" : "not-active" }}">
You can use this package I've written to do this: https://packagist.org/packages/arcesilas/active-state
Example with your code:
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Category
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Brand
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-pencil text-primary"></span>Model
</td>
</tr>
<tr>
<td>
<span class="glyphicon glyphicon-flash text-success"></span>Province
</td>
</tr>
</table>
</div>
</div>
This package also allows you to check a url, a route with given parameters or a query.

Ajax Get Data on Laravel

I'm really new to MVC hope you can give me a detailed instructions on this.
I have a query in my repository that returns pending users who have a certain role_id. Now my issue is this I when the administrator clicks on the anchor tag of id idMessenger below
<li> Messenger<span class="label label-danger pull-right">{{$messenger->count()}}</span> </li>
I want to show the pending messengers only in the
<div class="col-md-2 left-aside">
<div class="scrollable">
<ul class="inbox-nav capitalize-font">
<li>All Pending Applications </li>
<li>Clients<span class="label label-danger pull-right">{{$elderly->count()}}</span></li>
<li> Messenger<span class="label label-danger pull-right">{{$messenger->count()}}</span> </li>
</ul>
</div>
</div>
<!-- /.left-aside-column-->
<div class="col-md-10 right-aside">
<div class="scrollable">
<div class="table-responsive">
<table id="datable_1" class="table display table-hover contact-list" data-page-size="10">
<thead>
<tr>
<th>Appication ID</th>
<th>Name</th>
<th>Email</th>
<th>Senior Citizen Number</th>
<th>Role/Submitted as</th>
<th>Date of Submission</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
#foreach($allPending as $user)
<tr>
<td>{{$user->id}}</td>
<td>{{$user->name}}</td>
<td>{{$user->email}}</td>
<td>{{$user->scn}}</td>
<td><span class="label label-danger">{{$user->roles->name}}</span></td>
<td>{{$user->created_at}}</td>
<td>
<i class="fa fa-check"></i>Approve
</td>
<td>
<i class="fa fa-trash"></i>Delete
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
</div>
Can you please teach me how to do it in ajax.

How to access only specific item instead of all page with nokogiri [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm trying to scrape some information from a site using Nokogiri.
The site looks like this:
<div class="content">
<article class="mainarticle">
<div class="breadcrump">
<ul></ul>
</div>
<div class="boxstyle">
<h2 style="margin-top:0.1em;">Fahrschulen mit Namen "Hugis Fahrschule AG"</h2>
</div>
<section class="leftrightleft ">
<header>
<div class="borderright borderbottom pads">
<figure class="logoschule">
<a href="fahrlehrerbilder.php?irat_id=14581" onclick="showGallery('irat_gallery',14581);return false;">
<img alt="Bilder Hugis Fahrschule AG" width="110" height="110" src="http://www.fahrlehrervergleich.ch/images/lehrer/small/fe1774780ba2d3aaa3e985ee960bf8.jpg">
<figcaption class="gallerylabel minhide">1 Bild</figcaption>
</a>
</figure>
<div>
<h3>Hugis Fahrschule AG</h3>
<h4 style="padding:0;line-height:1.3em;">Thomas Hugelshofer</h4>
<span class="biger">Thomas Hugelshofer</span>
<p><span>Oerlikon</span><br><span>Schaffhauserstrasse 443</span><br><span>8050</span> <span>Zürich</span></p>
<p>Karte Streetview </p>
<p></p>
</div>
<table class="eintraegemain clearfix">
<tbody>
<tr>
<td>Homepage:</td>
<td><span>www.hugis-fahrschule.ch</span></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><a class="" href="kontakt_user.php?kontakt_id=14581" target="_blank" onclick="showEmailSender(14581);return false;">sekretariat#hugis-fahrschule.ch</a></td>
</tr>
<tr>
<td>Natel:</td>
<td><span>076 684 11 11</span></td>
</tr>
</tbody>
</table>
</div>
</header>
<div class="accordion">
<div class="accordion-section">
<a class="accordion-section-title accordeonfarbe-00" href="#accordion-1-14581"><span class="arrow"></span>Preise für Auto: ab 74.-, Auto Automat: ab 74.-, Motorrad: 90...</a>
<section id="accordion-1-14581" class="secondright accordion-section-content">
<div class="borderleft pads">
<table>
<tbody>
<tr>
<td>Kategorien</td>
<td>Preise CHF</td>
</tr>
<tr>
<td>Auto:</td>
<td>ab 74.-</td>
</tr>
<tr>
<td>Auto Automat:</td>
<td>ab 74.-</td>
</tr>
<tr>
<td>Motorrad:</td>
<td>90.-</td>
</tr>
<tr>
<td>Taxi:</td>
<td>74.-</td>
</tr>
<tr>
<td>Lastwagen:</td>
<td>165 .-</td>
</tr>
<tr>
<td>Lastwagen C1:</td>
<td>165.-</td>
</tr>
<tr>
<td>Auto Anhänger:</td>
<td>112.-</td>
</tr>
<tr>
<td>LKW Anhänger:</td>
<td>195.-</td>
</tr>
<tr>
<td>Car:</td>
<td>195.-</td>
</tr>
<tr>
<td style="font-weight:normal;">Lektionsdauer:</td>
<td style="font-weight:normal;">45 Minuten</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Kurse</td>
<td>Preise CHF</td>
</tr>
<tr>
<td>Verkehrskunde:</td>
<td>150.-</td>
</tr>
<tr>
<td>Nothelferkurs:</td>
<td>120.-</td>
</tr>
<tr>
<td>Motorrad Grundkurs:</td>
<td>160 pro Teil</td>
</tr>
<tr>
<td>Theorie:</td>
<td>Nach Anmeldung</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
<div class="accordion-section">
<a class="accordion-section-title accordeonfarbe-00" href="#accordion-2-14581"><span class="arrow"></span>Weitere Informationen: Sprachen: Deutsch, Englisch...</a>
<section id="accordion-2-14581" class="thirdleft accordion-section-content">
<div class="borderright pads">
<table id="sb_14581">
<tbody>
<tr>
<td>Sprachen: </td>
<td>Deutsch, Englisch, Serbisch, Albanisch, Türkisch, Polnisch, Italienisch</td>
</tr>
<tr>
<td>Autotyp:</td>
<td>Renauld Megan</td>
</tr>
<tr>
<td>Administration:</td>
<td>CHF 110.- (pauschal)</td>
</tr>
<tr>
<td>Jahrgang:</td>
<td>2015</td>
</tr>
<tr>
<td>Ausbildungsjahr:</td>
<td>2015</td>
</tr>
</tbody>
<tbody></tbody>
</table>
</div>
</section>
</div>
<footer class="clearfix">
<section>
<div class="bordertop pads" id="sbwl_14581">
<div class="ratingoutside">
<ul class="rating">
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li>(12)</li>
</ul>
</div>
<div class="rightbuts"><a class="buttonsmall" href="bewertungen.php?irat=14581" onclick="showBewe(14581);return false;" title="Bewertungen anschauen">Bewertungen anschauen</a>
<a class="buttonsmall" href="lernen/index.php?bewe_irat=14581">Fahrlehrer bewerten</a>
</div>
<p class="clicks minhide clearfix"> 30-Tage-Statistik : Inserat <span class="num_imp">14069</span> Mal angezeigt, Homepage <span class="num_click">228</span> Mal angeklickt. (sponsored)</p>
</div>
</section>
</footer>
</div>
</section>
<section class="leftrightleft ">
<header>
<div class="borderright borderbottom pads">
<div>
<h3>Hugis Fahrschule AG</h3>
<h4 style="padding:0;line-height:1.3em;">Thomas Hugelshofer</h4>
<span class="biger">Thomas Hugelshofer</span>
<p><span>8106</span> <span>Adlikon b. Regensdorf</span></p>
</div>
<table class="eintraegemain clearfix">
<tbody></tbody>
</table>
</div>
</header>
<div class="accordion">
<div class="accordion-section">
<a class="accordion-section-title accordeonfarbe-00" href="#accordion-1-13695"><span class="arrow"></span>Preise für Auto: 84.-, Motorrad: 90.-, Taxi: 95.-, Lastwagen:...</a>
<section id="accordion-1-13695" class="secondright accordion-section-content">
<div class="borderleft pads">
<table>
<tbody>
<tr>
<td>Kategorien</td>
<td>Preise CHF</td>
</tr>
<tr>
<td>Auto:</td>
<td>84.-</td>
</tr>
<tr>
<td>Motorrad:</td>
<td>90.-</td>
</tr>
<tr>
<td>Taxi:</td>
<td>95.-</td>
</tr>
<tr>
<td>Lastwagen:</td>
<td>165.-</td>
</tr>
<tr>
<td>Lastwagen C1:</td>
<td>165.-</td>
</tr>
<tr>
<td>Auto Anhänger:</td>
<td>112.-</td>
</tr>
<tr>
<td>LKW Anhänger:</td>
<td>195.-</td>
</tr>
<tr>
<td>Car:</td>
<td>195.-</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Kurse</td>
<td>Preise CHF</td>
</tr>
<tr>
<td>Verkehrskunde:</td>
<td>150.-</td>
</tr>
<tr>
<td>Motorrad Grundkurs:</td>
<td>160.-</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
<div class="accordion-section">
<a class="accordion-section-title accordeonfarbe-00" href="#accordion-2-13695"><span class="arrow"></span>Weitere Informationen: Sprachen: Deutsch, Englisch...</a>
<section id="accordion-2-13695" class="thirdleft accordion-section-content">
<div class="borderright pads">
<table id="sb_13695">
<tbody>
<tr>
<td>Sprachen: </td>
<td>Deutsch, Englisch, Französisch, Italienisch, Polnisch, Türkisch</td>
</tr>
<tr>
<td>Autotyp:</td>
<td>VW, BMW, MAN, SETRA, </td>
</tr>
</tbody>
<tbody></tbody>
</table>
</div>
</section>
</div>
<footer class="clearfix">
<section>
<div class="bordertop pads" id="sbwl_13695">
<div class="ratingoutside">
<ul class="rating">
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li class="icon icon-star-two"></li>
<li>(12)</li>
</ul>
</div>
<div class="rightbuts"><a class="buttonsmall" href="bewertungen.php?irat=13695" onclick="showBewe(13695);return false;" title="Bewertungen anschauen">Bewertungen anschauen</a>
<a class="buttonsmall" href="lernen/index.php?bewe_irat=13695">Fahrlehrer bewerten</a>
</div>
<p class="clicks minhide clearfix"> 30-Tage-Statistik : Inserat 307 Mal angezeigt. </p>
</div>
</section>
</footer>
</div>
</section>
<ul class="paginator"></ul>
<section class="texttabs clearfix">
<p>
Fahrschulen in der Schweiz: Fahrschulen und Fahrlehrer für Auto, Motorrad, Lastwagen, Taxi und Boot. Verkehrskunde (VKU), Nothelferkurs, Motorradgrundkurs. Informationen zu Strassenverkehrsamt, Lernfahrausweis, Fahrprüfung, WAB hier im Schweizer Fahrlehrervergleich.
</p>
<p>
Der Schweizer Fahrlehrervergleich gibt Auskunft über Fahrschulen und Fahrlehrer, die in folgenden Kategorien unterrichten: Auto, Motorrad, Lastwagen, Taxi und Boot. Ebenfalls werden Angaben über Verkehrtheorie, Motorradgrundkurs, Nothelferkurs und Theorietraining gemacht. Finden Sie eine Auto-, Motorrad- oder Lastwagen-Fahrschule, Informationen zu Ausbildung, Grundkurs, Theoriekurs, Schleuderkurs und Autoprüfung. Fahrschule Fahrschulen Fahrlehrer Zürich Bern Basel Luzern Aargau Schweiz. Der Schweizer Fahrlehrervergleich beinhaltet über 5000 Fahrschulen und Fahrlehrer aus der ganzen Schweiz.
</p>
</section>
</article>
<aside>
<h2>Fahrlehrer und Fahrschulen finden</h2>
<section class="filterbox regone boxstyle">
<h3>Fahrschulen </h3>
<ul>
<li><a title="Fahrschule Hugis Fahrschule AG" href="http://www.fahrlehrervergleich.ch/fahrschule-Hugis-Fahrschule-AG-Z%C3%BCrich-fahrschule-14581.htm">Hugis Fahrschule AG</a></li>
<li><a title="Fahrschule Hugis Fahrschule AG" href="http://www.fahrlehrervergleich.ch/fahrschule-Hugis-Fahrschule-AG-Adlikon+b.+Regensdorf-fahrschule-13695.htm">Hugis Fahrschule AG</a></li>
</ul>
</section>
<section class="filterbox regone boxstyle">
<h3>Sprachauswahl</h3>
<ul>
<li><a hreflang="de" href="http://www.fahrlehrervergleich.ch" title="Schweizer Fahrlehrervergleich">Schweizer Fahrlehrervergleich</a></li>
<li><a hreflang="fr" href="http://auto-ecole.comparatif.ch" title="Comparatif d'auto-écoles suisses">Comparatif d'auto-écoles suisses</a></li>
<li><a hreflang="it" href="http://autoscuola.comparazione.ch" title="Confronto delle autoscuole svizzere">Confronto delle autoscuole svizzere</a></li>
<li><a hreflang="en" href="http://driving-instructor.fahrlehrervergleich.ch" title="Swiss Driving Instructors">Swiss Driving Instructors</a></li>
</ul>
</section>
<section class="filterbox regone boxstyle">
<h3>Siehe auch...</h3>
<ul>
<li>
<a href="http://www.zahnarztvergleich.ch" title="Schweizer Zahnarztvergleich">
Schweizer Zahnarztvergleich </a>
</li>
<li>
<a href="http://www.treuhandvergleich.ch" title="Schweizer Treuhandvergleich">
Schweizer Treuhandvergleich </a>
</li>
<li>
<a href="http://www.anwaltvergleich.ch" title="Schweizer Anwaltvergleich">
Schweizer Anwaltvergleich </a>
</li>
<li>
<a href="http://www.coiffeurvergleich.ch" title="Schweizer Coiffeurvergleich">
Schweizer Coiffeurvergleich </a>
</li>
</ul>
</section>
</aside>
</div>
My code looks like this:
doc = Nokogiri::HTML(page)
doc.css(".leftrightleft").each do |item|
title = item.at_css("h3 a").text
address = item.at_css(".biger+ p , h3+ p")
address.search('br').each do |n|
n.replace(" ")
end
address = address.text
puts "-----"
puts title
puts "Address:"
puts address
puts "Course Types:"
item.css("table+ table tr+ tr").each do |type_price|
if type_price.css("td")[0] && type_price.css("td")[1] != nil
course_type = type_price.css("td")[0].text
course_type.gsub!(":", "")
price = type_price.css("td")[1].text
puts "\t #{course_type}: #{price}"
end
end
end
The problem is that when I do item.css("table+ table tr+ tr").each do |type_price| it's doing it for all items below that one and not only for that item in specific.
Can someone explain me what I'm doing wrong?
I've figured out a way to solve this.
Instead of making the loop like this item.css("table+ table tr+ tr").each do |type_price|, that makes it loop to the all page from item until the end of the page, I'm doing it like this item.at_css("table+ table tbody").css("tr+ tr").each.
With this solution I'm getting just the first table element and then I loop through the rest of the rows and it works.
I took a look and it seems that Nokogiri is jumbling the elements due to weird markup.
Switching to HTML5 is probably the best bet:
require 'nokogumbo'
doc = Nokogiri::HTML5.get(uri)
I should really say that libxml is doing the jumbling rather than Nokogiri.

Resources